Writing Excel Templates
This section contains information about creating Excel templates.
What are the Excel templates?
Excel templates are .xls or .xlsx files that contain scripts and special tags that are written into the cells of the template files. The scripts control what content is exported and how it is formatted.
During export, the scripts are evaluated for Codebeamer entities (for example, bugs, issues, tasks, requirements, etc. from the tracker), and the results are generated in the form of the Excel document. Elements of the original template that do not contain scripts, such as charts,are preserved.
The Excel export uses
JETT., an open-source templating engine. For more detailed information, see documentation on
Jett’s website.
Creating Simple Export Templates
To create a simple export template, create a new Excel spreadsheet, and add your scripts into cells of the new spreadsheet. For example, the following script exports an item’s status and description to the Excel spreadsheet:
Status
|
Description
|
${items.status.name}
|
${items.description}
|
During the export, Codebeamer searches the Excel template to find the scripts by looking at the content of the cells. For example, if the ${items.description} script is found, itis evaluated for each of the exported items (TrackerItemDtos), and the results are then exported to the Excel spreadsheet.
If the script uses the items variable, then the script will be executed once for every item, and a new row will be automatically created in the exported spreadsheet.
Implicit Collection Processing with the items Variable
When using the items variable in a script that gets automatically recognized, single rows that contain the ${items.description} script are evaluated for every issue. Each result is then added to the spreadsheet as a new row.
The following screenshots show the template and the result:
Exporting Issue Properties
You can access the properties of an issue using a simple expression language that uses the common $ and dot notation. For example, ${items.description} can be used to access the item.getDescription() JavaScript getter.
The export engine uses the
JEXL expressions for scripts. For more information, see
JEXL syntax and
JEXL examples