cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Export to Word or RTF

mrump
14-Alexandrite

Export to Word or RTF

I'm looking for a way to export Integrity Items into formats other than HTML.

Example:

We have a test-plan that is linked to several test-objectives and their test-sessions and related defects.

Our test department wants to create a test report document based on the data stored integrity for this test-plan.

As integrity is not the only source of data they need the ability to add additional information to the generated document.

So what I'm searching is a way th generate a Word or FTF document based on a Testplan.

As far as I know the Gateway tool can only export "segment" Items, so that is no option.

Currently all I can only produce HTML or XML reports using the "im runreport" command.

Any other ideas?

5 REPLIES 5
dhegland
1-Newbie
(To:mrump)

I've found that powershell scripts are a handy way to go. It takes some climbing to surmount the first couple hills on the powershell learning curve, but after doing so, you'll find you can retrieve the items and fields, retrieve related data from other systems, deliver them all to the powershell pipe as objects and properties, output them as xml, and translate the xml as needed into anything!

mrump
14-Alexandrite
(To:dhegland)

Hi David,

thanks for the quick answer.

Just to ensure that I got your idea right, here's some pseudo code for a powershell script:

- retrieve Integrity Item id from script arguments

- use CLI "im viewissue --xmlapi" or webservice to retrieve the issues content and cache it

- repeat for related items until al required data is present

BTW: (I am afraid Rich Text Fields in IM will be tricky)

- transform XML data as needed

- create a new Word document in a default location as "output stream" using powershell features

- write the documents content "line by line" posting the "processed" xml data from cache

Did I miss something?

I'd already thought about doing the same with a custom Java tool using Apache POI (as I did in the past for creating special parsers) but I postponed the idea due to the maintenance effort for such a special solution.

Although I like your approach, it is not exactly what I'm looking for.

My intention is to use use as much "out of the box" features from integrity as possible, to limit my dependency on a stable API.

My initial plan was to find a way to generate an IIF document and paste that into the Gateway tool, but coming to think of it, I now see the problem that in the mapping file it might not be possible to differentiate between the various related items' types.

I also thought about a XML report that could be postprocessed using XSL-FO to create a RTF document, but I have no idea how to integrate the FO-processor into my Integrity Server environment.

Any idea in that area would be GREAT.

dhegland
1-Newbie
(To:mrump)

Agreed that RTF is the main challenge. I'm glibly assuming that the RTF will survive my proposed route of extraction, but unsure.

I would try a powershell script that begins like you said with and item ID. Here's a quick pseudo example which is clearly missing recursion but gets the main point across.

# call this "get-documentsegments.ps1" or similar

# requires one arg, the doc id. see "advanced functions" for better arg handling

$docid = args[0]

$segments = im.exe issues --fields=Contains $docid

$segmentids = (([String]$segments).split(',')) # ...or something vaguely similar

$segmentids | foreach {

$section = im.exe viewissue --fields=Section $_

$rtftext = im.exe viewissue --fields=Text $_

New-Object Object |

Add-Member NoteProperty ID $_ -PassThru |

Add-Member NoteProperty Section $section -PassThru |

Add-Member NoteProperty Text $rtftext -PassThru

}

The above, when fully done and tested and with recursion added, will stream out a powershell object for each section having properties "ID", "Section" and "Text" which can then be used in downstream code. I've been using the heck out of this technique for non-RTF. I hope this terse example is some help, if not for documents then perhaps for something else. Good luck!

Hi Matthias,

The Integrity reporting engine is a good way to go if it can be made to work for your situtation, since it has the built-in ability to walk the various relationships and extract desired information efficiently, and can be parameterized/configured via a wizard.

Although the vast majority of the "recipes" shipped with the server are in HTML format, you can use any text format you wish. The reporting engine only looks for specific tags to decide where to iterate and substitute values, and leaves the rest untouched. The surrounding text could be XML, CSV, or any custom format you wish. You could copy and alter one of the HTML recipes to be in another custom format, but of course emulating .docx or a similar structure directly would be extremely difficult.

If your desired result is a Word document, could you perhaps adjust an HTML report recipe to produce a file arranged to open "as well as possible" in Word? Depending on the desired final format, you may be able to remove the majority of formatting and switch to simple <h1> and <p> tags, which hopefully when opened/imported in Word will result in a usable format that you could then resave in .docx or other format.

The built-in format of rich text fields is a subset of HTML, so staying in HTML format avoids having to try and convert or strip the contents of rich text fields.

You can also certainly use various scripting approaches, but depending on the total size of your document you may have poor performance doing many recursive/repeated individual calls. Using "im issues --fields=<list of desired fields>" is best, and supplying multiple item IDs or a query name/definition will help reduce the server roundtrips and separate SQL queries. Doing "bulk calls" and then linking up the data is sometimes easier to achieve in a full app (e.g. Java with temporary HashMaps and the like), but comes with a maintenance burden as you point out.

Regards,

Marcus

Hi Matthias,

it seems to me, that you are also in this entry requesting the export of items to Word. As I posted in one of my other responses today, I am able to retrive any data from Integrity using a custom Gateway extension.

Please let me know if your request is still valid. I would be pleased to give you the needed support.

Volker

Top Tags