Create a two column PDF document
Knowing that there is no special element in RPE Pallet to create multiple column documents I was looking to find an alternative to be able to create a two column PDF document.
After a quick research I’ve seen that MS Office Word 2007/2010 provides the functionality to save a Word document in PDF format. Based on that and the fact that I could use a stylesheet to generate a two column document in Word my solution will contain the following steps:
- Extract the specific data contents (in my case I’ll extract all the requirements from a DOORS module).
- Use a styesheet to generate a two column document.
- Use a macro to save the Word output to PDF.
- WORD 2007/2010
- Rational Publishing Engine 1.1.1 or later
- DOORS 9.3 or later
Create a simple template to publish all the requirements from a DOORS module.
Create a Word stylesheet to specific that the output will have a two column layout. To create a stylesheet in Word, go to File->New->Blank Document. In the newly created document go to the main menu and select the Page Layout entry. Then open the “Columns” combo list and select the “Two” columns value. Save the stylesheet with a suggestive name like: two_columns_stylesheet.doc.
Create a VB Macro to save the document in PDF format.
To create the macro, open the two_columns_stylesheet.doc and in the main menu select “View Macros”.
Use the “Create” button to create a new macro. The VB script should be like this (FileName – the location where the PDF file will be saved):
Sub saveAsPdf()<br /> ActiveDocument.SaveAs FileName:="c:/RPE/doors/requirements/req.pdf", FileFormat:=wdFormatPDF<br />End Sub
Open the Launcher perspective and configure the document specification. First you need to properly configure your DOORS data source and then you need to configure the Word output.
In the document specification view, select the Word output and then go to Properties view. You have to set the path, stylesheet and macro properties. See my configuration below:
Now the document specification is configured and you can publish the document. After the document generation, automatically the Word file is open. The PDF file is saved in the directory specified in the macro. In my case: c:/RPE/doors/requirements/req.pdf.
“E voila” the two column PFD file containing all the requirements from a DOORS module: