Assuming you have a custom Wiki field in a tracker, and because this is Wiki field it may contain rich text elements like bold or italic text or even images.
Now you want to see the same rich text and also the images of this field in your Word export file too.
This is simple to do, the key elements are:
- Create a custom Word export template
- In your Word export template modify the velocity script to render the custom field as HTML, this is how it is done. Find the Velocity script which renders the Properties of the export items, and add such script there:
## clear variables may have set previously
#set($wiki = "")
## access custom field values
#set($wiki = ${describable.getCustomField(0)})
#if ("$!{wiki}" != "")
<b>Wiki:</b> $wikiMarkupProcessor.transformToHtml($!{wiki}, “W”, false, false, $wikiContext)
<br/>
#end
The key element here is the $wikiMarkupProcessor.transformToHtml(...) method call which converts the Wiki text to HTML. If that HTML contains images those will be attached to the Word document automatically.
Here is a modified Word document which contains the script: example Word template
For a more complete explanation see the export Pre-Action and Post-Action fields of the TestCase trackers