Book a Demo

Author Topic: Importing word-files as requirements  (Read 10665 times)

jskeletti

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Importing word-files as requirements
« on: August 18, 2011, 12:06:48 am »
Hello!

I've got a little problem. I've got to write an addin which imports requirements from word file to EA. Creating an add in is no problem, but parsing word. The are tables and images in requirement notes and I don't know how to insert them to the req. Has someone an idea?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Importing word-files as requirements
« Reply #1 on: August 18, 2011, 01:47:33 am »
Ask in a M$ forum...

q.

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1353
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Importing word-files as requirements
« Reply #2 on: August 18, 2011, 07:35:09 am »
You've got your work cut out as MS Word is really free form. Unless you can restrict the format of the MS Word document its going to be near impossible.
Changing unstructured data to structured will require some form of tagging to identify fields such as name, notes etc. So you might want to try a multi-phased approach.
1) Parse and tag text ready for extraction.
2) Let the user verify the tagged text and alter if necessary.
3) Convert the tagged text to a CSV file
4) Import CSV to EA

The images are probably a no-go unless they've been done in Visio. There is a plug-in to import images. Cross referencing whats in the images and the word doc will probably be near impossible as there will be no referential integrity in the MS Word doc.

I recall DOORS does something similar converting MSWord to its structured format.
Happy to help
:)

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1353
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Importing word-files as requirements
« Reply #3 on: August 18, 2011, 07:37:31 am »
Another thought. Save the MS word doc to RTF and use regular expressions to extract the data by referencing the RTF tags.
Happy to help
:)

jskeletti

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Importing word-files as requirements
« Reply #4 on: August 18, 2011, 05:06:25 pm »
There is "some" structure in the document and it can be also adapted. My problem is to add the pictures and tables in EA/a requirement using the api. I've created a requirement, gave it an alias, status etc. There is
Code: [Select]
Element req =  m_Package.Elements.AddNew("Req name", "Requirement");
...
req.Notes += txt; // Here: notes is string, so it can't receive a pic or table!

Is it possible to use HTML in req.Notes?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Importing word-files as requirements
« Reply #5 on: August 18, 2011, 05:50:07 pm »
You can use a linked document for requirements.

q.

jskeletti

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Importing word-files as requirements
« Reply #6 on: August 18, 2011, 06:47:32 pm »
How? When I try this, it doesn't work:
Code: [Select]
Element req = m_Package.Elements.AddNew("TEST", "Requirement");
req.SaveLinkedDocument("temp.rtf");

jskeletti

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Importing word-files as requirements
« Reply #7 on: August 18, 2011, 06:58:14 pm »
Ok, I got it: It's not save but req.LoadLinkedDocument("temp.rtf");

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Importing word-files as requirements
« Reply #8 on: August 19, 2011, 06:15:23 pm »
Just an off-topic information. Try to reduce your requirements to pure text (which of course can easily be stored in the notes). We use a mix where all text goes to the notes. Only where needed we use linked documents to store pictures. The notes then read "[see linked document]' at the appropriate location. Similarly for tables (which should be avoided anyway).

q.

skiwi

  • EA Expert
  • ****
  • Posts: 2081
  • Karma: +46/-82
    • View Profile
Re: Importing word-files as requirements
« Reply #9 on: August 31, 2011, 02:15:16 pm »
you can also use diagrams to store 'pictures'
Orthogonality rules
Position and Team disestablished, thanks austerity.
Now itinerant.

fwoolz

  • EA User
  • **
  • Posts: 435
  • Karma: +0/-0
  • We have met the enemy, and he is us.<Pogo, 1970>
    • View Profile
Re: Importing word-files as requirements
« Reply #10 on: August 31, 2011, 03:11:41 pm »
I once cobbled together an add-in (actually 2 - one for EA and one for Word) that wrapped all paragraphs, tables, and images in the Word document in content controls, then saved each content control as RTF in a big zip file, notified the EA add in via a socket that requirements were ready for import, then imported the zipped RTF into EA, expanding each saved content control as a linked document associated with a new requirement. This was an attempt to emulate DOORS in EA, btw. It worked, but it was horrendously slow. I dropped work on it at that point.
Fred Woolsey
Interfleet Technology Inc.

Always be ready to laugh at yourself; that way, you beat everyone else to the punch.