Word Templates in CB 9.4 and higher #6933134/v449 |
Tags:
not added yet
Advanced Word Export Features
These features are available from codeBeamer 9.4.0. The supported version is Microsoft Word 2016.
In codeBeamer 9.4 a set of new features has been introduced on top of new Word export solution introduced in 9.3. See: List available fieldsThe user can obtain a document which contains all merge fields available in a specific export context. This is derived from the current status of the tracker configuration, so it is up-to-date as long as it is unchanged. The available fields depend on the trackers in scope or the current use case (for example, tracker export, traceability export, or review export). The user has to start an export using the following template: template-list-all-fields.docx and the resulting document will contain all available fields. Content of the resulting document will be a field name listing. Structure is as follows:
Conditional templatesFrom codeBeamer 9.4.0, Word templates can contain conditional parts based on item properties. These conditional blocks can be defined using bookmarks (similarly to loops). Example template below contains two conditional blocks: "if_folder" and "if_not_folder". In this example, folders will be printed as only a name and an underline. Items of other types will have their properties and description included. Example: template-if-folder.docx.
Ignore empty foldersTo ignore empty folders in the exported document, "if_not_empty_folder" can be used instead of "if_folder".
Custom conditionalsConditional template blocks are evaluated using velocity macros which are defined in the same velocity macro library as the merge fields themselves. The location of the velocity macro library is the following: tomcat/webapps/cb/config/templates/export/mergefields.vm New conditional macros can be easily added to this file. The name of the macro can then be used as a name for conditional blocks. The JSON representation of the item is available through the $item variable, which is an instance of com.google.gson.JsonObject. See API documentation here: GSON API 2.3.1 Example: #macro(if_folder) #set($type = $item.getAsJsonObject("type").get("name").getAsString()) #if ($type == "Folder") true #else false #end #end Limitations
Rendering parametersThe template document can contain extra rendering parameters, see below. The user can simply copy this part of the template from an example (template-ignore-html.docx).
Parameter values are defined using Word Content Controls. Parameters are identified by the name of the control. (To enable the Content Control user interface in Word, go to: Options / Customize Ribbon / check Developer.)
Rendering parameters can be included in or excluded from the export document based on the option "Remove rendering parameters". Ignore HTMLFor the specified wiki fields, HTML formatting will be completely ignored and images will be omitted. In the above example, the fields "description" and "preAction" will only have plain text content. Replace empty stringsIt can be specified in the template what a certain value is inserted into the fields which would otherwise be empty. The default value is "--". Export AttachmentsWhen exporting items to Word, it is also possible to include attachments of the items. In case attachments are exported, the user will get a zip package not just a single document. Attachment files are packed together with the document in a single archive. When opening the document, make sure that you extract the whole package. The file structure of the package looks like the following: testing - Customer Requirement Specifications ├── attachments │ ├── 22192 │ │ ├── 129144_2007_09_10_miurablueprint.jpg │ │ ├── 129145_cblogo-xl.png │ │ ├── 129149_cbopen.vbs │ │ ├── 129150_kern.log │ │ └── 129151_kern.txt │ ├── 22193 │ │ ├── 129146_egy.bmp │ │ └── 129147_zizi.pdf │ └── readme.txt └── testing - Customer Requirement Specifications.docx The "attachments" directory contains all attachments from the export. This contains a subdir for each item exported, named by the exported item's id. The original file names are kept, but the attachment id is added as a prefix. The attachment id is globally unique in itself, so it clearly identifies the file. The ".docx" file next to the attachments dir is the result docx file: it contains links to the files in the "attachments" as applicable. To enable attachment export, the docx template must contain the merge field <<item.attachmentsList>>. This also defines the place where the links and images will be inserted. There are three different modes for exporting attachments:
The configuration of these options can be done through the docx template. See below: Here is an example template which contains the configuration for the export of attachments: template-items-export-attachments.docx.
|
Fast Links
![]() codebeamer Overview codebeamer Knowledge Base Services by Intland Software |
This website stores cookies on your computer. These cookies are used to improve your browsing experience, constantly optimize the functionality and content of our website, and help us understand your interests and provide more personalized services to you, both on this website and through other media. With your permission, we and our partners may use precise geolocation data and identification through device scanning. You may click accept to consent to our and our partners’ processing as described above. Please be aware that some processing of your personal data may not require your consent, but you have a right to object to such processing. By using our website, you acknowledge this notice of our cookie practices. By accepting and continuing to browse this site, you agree to this use. Your preferences will apply to this website only.
Note that user-behavior analytics are being captured on this server to improve the Codebeamer user experience.