Inserting a file as an object into the Word output document offers several advantages over hyperlinks. First, users can transfer output documents with embedded objects (compound Word document) to other computers or mail them without breaking any links. Second, users can edit embedded objects without changing the content of the original. Sometimes, this separation is precisely what is required. These embedded objects can be edited using the applications which created the source files.
Here is an example that shows how to embed attachments from point products (ex. Rational Quality Manager) as objects in Rational Publishing Engine (RPE) output document. The attachment files could be of any format such as Word, Excel, PowerPoint, PDF, image, etc. These files are downloaded during document generation and the local file path is used as the hyperlink address. We will use a post processing macro that iterates the hyperlinks and insert the corresponding files as OLE objects.
Template Design (Sample):
Steps:
- Configure document specification
- Copy RQMUrlUtility.jar (https://jazz.net/wiki/bin/view/Main/RQMURLUtility) to the location set in attachmentsPath variable.
- Set variable attachmentsPath to location where the files to be downloaded. By default, it is C:\Attachments
- Set RQM Username and Password to qmUser and qmPassWord variables respectively.
- Generate document.
Word output (Sample):
The accompanying Rational Publishing Engine template, document specification, stylesheet along with RQMURLUtility can be downloaded from here.
Note: The execution of commands is disabled by default in RPE 1.3 and later versions. You can enable command execution by setting the com.ibm.rational.rpe.enable_commands property to true in %rpe_home%\studio\rpe-studio.ini and %rpe_home%\launcher\rpe-launcher.ini.
Disclaimer: Any code or file accessible or downloadable in this post is provided as is, without warranty of any kind. IBM does not provide support for this.
Subramanya Prasad Pilar
Persistent Systems
subramanya_pilar@persistent.com
You must be logged in to post a comment.
Hello Subramanya,
Thank you for sharing this interesting article with us. I would like to Generate Word document from Rational Publishing Engine with attachments embedded as objects but not from Rational Quality Manager. i want to extract information from DOORS NG module. Can you help me accomplish this task please?
Thank you in advance!
Mario Matov
If you can somehow download the files/WrapperResources from DNG, you can include them as OLE in the same way. You can check if cURL or wget works for DNG. I haven’t explored the options for DNG.
Hi Subramanya – unfortunately the link to the template gets me to a site where it asks me to login, and I don’t have an account – before it does let me download the RPE template all other files.
Can you please advise
cheers
Werner
@werner, I tried using a browser without credentials to download the PUB template and other files and it did not ask me for any credentials. So, it should work in your case too. Could you double-check if you still have the issue?