## Renders linked item text (not link itself)## Example: "REQ-1234: User Authentication"## Input: <a href="#">REQ-1234: User Authentication</a>## Output: "REQ-1234: User Authentication"
## Strips HTML tags, preserves text content## </li> converted to newline for proper list rendering## Input: <ul><li>Item 1</li><li>Item 2</li></ul>## Output:## Item 1## Item 2
## Set empty cell placeholder (default: blank)#set($emptyPlaceholder = "N/A")$exporter.exportMainSheet( $gridSettings, "", $emptyPlaceholder)## Result: Empty cells show "N/A" in PDF
#set($doc.pageAdded) ## Executed after each new page is created ## Useful for headers, footers, background images $drawImage("document-header.png", 0, 0, 800, 50)#end
Page event handlers do NOT persist automatically across #newPage() breaks. You must reapply the handler after each page break if you want headers/footers/images on subsequent pages.
## Check if baselines are present#if($document.baselines && $document.baselines.size() > 0) ## Iterate over available baselines #foreach($baseline in $document.baselines) $baseline.name $baseline.revision $baseline.created #end#end
## Include only baselines from specific document path#set($includeBaselines = [])#foreach($baseline in $document.baselines) #if($baseline.documentPath.contains("/MyProject/")) $includeBaselines.add($baseline) #end#end## Export with filtered baselines#set($filteredGrid = $filterByBaselines($gridSettings, $includeBaselines))$exporter.exportMainSheet($filteredGrid, "", "")
## Include specific baseline by ID#set($targetBaseline = "baseline-v2.1")#if($document.baselines) #foreach($baseline in $document.baselines) #if($baseline.id.equals($targetBaseline)) ## This baseline is included #end #end#end
When comparing two revisions, additional context is available:
Copy
Ask AI
## Check if in comparison mode#if($isInCompare) Comparing revision $currentRevision against baseline $compareRevision Show unchanged items: $showUnchangedEnd## Conditionally include items based on change status#foreach($item in $gridSettings.data) #if($item.hasChanged || $showUnchanged) ## Include in PDF #end#end
## Gracefully halt export with message#if($invalidConfiguration) #set($STOP) Error: Configuration is invalid. Please fix before exporting.#end## Export continues normally if condition not met
User Clicks Export to PDF ↓ Fetch PDF Export Script from /api/pdfscript endpoint ↓ Execute Velocity Template with full context ↓ Populate Variables: - $document metadata - $gridSettings data - $exporter utilities - $config styling ↓ Build PDF: - Add headings/text - Export grid table(s) - Apply styling - Format cells by type - Handle multi-page breaks ↓ Render & Download PDF
PDF export Velocity templates are configured via risksheetPdfExport.vm property and can be attached to Polarion documents for per-document customization or stored in global templates for project-wide defaults.
For exports with hundreds of rows, configure reasonable row limits or use sub-table exports to create focused, manageable PDF sections rather than single massive tables.
Baseline filtering must be implemented in your Velocity template. Baselines are provided in context but require explicit filtering logic to include or exclude from the PDF output.