Velocity Templates
Core Velocity template syntax, available context variables, macro definitions, and best practices for all Risksheet template types.
Top Panel Template
Customize the panel above the Risksheet grid with buttons, filters, summary statistics, risk profile displays, and interactive controls using Velocity and HTML.
PDF Export Template
Configure PDF export layout, page structure, table formatting, and content rendering using the
risksheetPdfExport.vm Velocity template and export helper macros.Custom Renderer Templates
Build custom cell renderers and row header renderers using client-side JavaScript functions (registered from the top panel template) for specialized data display and conditional visual formatting.
Template Resolution Flow
Templates follow the same inheritance chain as the sheet configuration. When Risksheet loads a template (such asrisksheetPdfExport.vm for PDF export), it searches for the file in this order:
Template Types Summary
| Template File | Purpose | Server Endpoint | Rendering Engine |
|---|---|---|---|
risksheetPdfExport.vm | PDF export script generation | /api/pdfscript | Velocity + JavaScript |
| Top panel Velocity template | Custom UI panel above the grid | /api/panel | Velocity + HTML |
pdfExportMacros.vm | Shared helper macros for PDF export | Included by PDF template | Velocity |
serverRender column scripts | Per-column custom cell rendering | Per-column configuration | Velocity |
| Row header renderer | Custom row header display | headers.rowHeader.renderer | JavaScript function |
Template Context Access
All Velocity templates have access to a rich context that includes:| Context Variable | Description |
|---|---|
| Document object | Current Polarion LiveDoc document with metadata |
| Transaction | Active Polarion transaction for data operations |
| Polarion services | Server-side API for querying work items and project data |
| Velocity tools | Standard Velocity utility classes for formatting and logic |
| Risksheet configuration | Current sheet configuration settings including columns, levels, and dataTypes (enum and rating scales come from Polarion enumerations, not the sheet configuration) |
| Revision parameter | Document revision for historical views (PDF export) |
If a Velocity template contains syntax errors or references unavailable context variables, Risksheet renders the error as a red message box in place of the expected output. Check the Polarion server logs for detailed template rendering errors.
Related Reference
- Risksheet.json Format for the main sheet configuration structure that templates extend
- Template Path Configuration for configuring document creation paths and template folder settings
- Document Configuration Override for the override workflow that creates document-specific templates
- Velocity Template Context for the full list of available context variables in Velocity templates
- PDF Export API for the programmatic PDF export interface and export functions available to templates