Word Templates in CB 7.2 - 9.2 #195719/HEAD / v5510 |
Tags:
not added yet
Table of Contents
Word export CustomizationSince Codebeamer version 7.2 Word export of Issues has been enhanced greatly, so requirements and other kind of issues can be exported to Microsoft Word, changes can be made on this export document, and some time later these changes can be seamlessly re-imported to CodeBeamer. This is so called Rountrip export that heavily uses Word's capabilities, so this feature requires Microsoft Word 2007 or later. Neither earlier Microsoft Word versions nor open source alternatives like Libre/OpenOffice are supported. When exporting issues from Word you have several options that are offered by the export dialog. An example of this dialog is seen here:
Managing templates: and how to get the "Default" template as starting point for customizations?You can create your custom Word export template files for your custom exports. When you need to create a custom Word template then it is always best to start the customization based on the default templates shipped with codeBeamer. The carefully customized templates are then can be uploaded and stored in codeBeamer so they can be selected for any exports later when needed. For more information about managing Templates see: Adding and customizing templates for Word and Excel export The default and custom templates are both accessible if you click on the "Manage custom templates" link like here: That opens up the directory in Document Management where the custom templates can be stored. The default template also is downloadable from here: Customizing Word export's look and contentThe content and look of the export can be customized by using a custom Word template. As highlighted on the previous screenshot the export dialog allows you to choose a customized Word template document during export. The customized templates are managed and stored in a special folder inside the Document Management. This folder can be easily accessed by clicking on the "Manage custom templates" link on the export dialog. You can upload your customized templates to this directory, and use all the benefits of the Document Management. For example you can control who can use the template by setting up the permissions on the files, or access historical versions of templates etc... As starting point for customizations you should create a copy of the default export template. This file is shipped with Codebeamer and can be downloaded on this export dialog by clicking on the "Download default Word template" link on the bottom right (follow arrows). Structure of the export document and templateThe export document contains these parts:
Each of these parts has slightly different customization options which is detailed below: Customizing Header and FooterHeader and Footer can be simply customized by editing their contents in Word. For example replacing the Codebeamer logo with a custom company logo is just matter of adding the new logo image here. Additionally you can add Word fields in this areas, where each field's name is evaluated as and expression during export. For example the default template contains a DocProperty field "project.name". The "project.name" is evaluated as a groovy expression during export, and so the field will contain name of the project of the exported tracker. This screenshot illustrates this:Such fields' can contain any valid Java/Groovy expression and will be automatically filled during export. Customizing Overview and introduction partThis part is appearing at the beginning of the template document, and in the default template it contains many fields like the exported project's name, the document title, author, the "Table Of Contents" and more.This part works the same way as was described in the Header/Footer part: the fields' name is evaluated as groovy expression during export, and the result of that evaluation is inserted to the result document. Here you can also insert the rendered Wiki description of the exported objects. For example the exported Project's description is inserted using this field: Customizing exported issuesThe export document contains several issues and for each issue it contains:
All these parts are somewhat customizable in the template document, which contains blocks of scripts that controls exporting these contents. These scripts are evaluated for each issue, and the result is inserted to the export document. Customizing the Name part of issuesThe Name part is the first part which exports the name of the issue. The content of this is a HTML markup, which is generated by the Velocity template which can be found in the default template document as shown here: So to customize the content or look of you will need to modify the Velocity template here. The output should be a valid html fragment - without the HTML body or head, that is added automatically. The Velocity script can access the same variables as other scripts, plus these:
Customizing read-only properties of issuesThe next part that will be added for each issue is the read-only properties. The content of this part also is a HTML markup generated by a Velocity template. That template is embedded into the default template document as visible here: The default Velocity script produces HTML tables for the downstream and upstream associations of the issue, and the downstream and upstream references of the issue. Customizing editable properties of issuesThis is the next part which contains the editable properties of each issue. Unlike other parts this is implemented as a native Word table and using Word's own Content Control elements. What happens during the export here that the exporter will look for any Content Control elements inside this table. The "Tag" property of the found Content Control elements are then used as an groovy expression, and evaluated on the current issue, and the result is inserted to the table. If the property is not available on the issue (for example the Tracker of that issue does not contain it) then the whole row of the table is removed. If a "Drop-down" Content Control elements is found then the exporter will also insert the possible choice-values, so the export document will correctly show the options. As an example this screenshot shows how is the Priority of issues can be configured. First click on the "Priority" Content Control inside Word, and then the "Properties" button on the "Developer" tab, which opens up the dialog to customize this field. The "Tag" value of this drop-down now contains "editable:Priority". The "editable:" prefix makes this field editable in the export, and the "Priority" is the field name on the "issue" being exported: (Hint: the "Developer" tab is not visible in Word by default, but can be turned on as described here) Customizing description of issuesFor each issue the Description also is exported using a HTML fragment, which is generated by a Velocity template. This template is found and customizable here:List of Objects/Entities available in the export scriptsThis table lists the objects available in the Velocity/Groovy scripts above:
Using properties of Objects/Entities available in the export scriptsAbout figuring out what properties are available on of these CodeBeamer objects: please look at the remote-api documentation and the javadoc found in. As you may already know CodeBeamer provides a rich API for querying and manipulating CodeBeamer objects programmatically using an RPC protocol. This API is documented here: You must login to see this link. Register now, if you have no user account yet. The Javadoc of the remote-api is available here So the remote-api contains the Javadoc of most internal CodeBeamer objects I've listed above, and is shipped with the CodeBeamer distribution. You can find it below your CodeBeamer installation directory on a path like: $CB_HOME/tomcat/webapps/cb/codebeamer-api-{version}.zip. If you unzip this zip file somewhere then you will see a "docs/api/" directory where the generated Javadoc resides. Open the index.html here and you will find the Javadoc and properties of the objects (like our TrackerItemDto). Be warned however that the signature of these objects, the export scripts may and practically will change between any new CodeBeamer releases in the future. I would strongly recommend that you try to keep your customizations as isolated as possible, and using a git repository for tracking such changes is recommended. This will make your life much easier if you plan to upgrade CodeBeamer in the future... Using Microsoft Office specific HTML/XML tagsSometimes you might need to use Microsoft Office specific HTML css styles in your templates, some limited information can be found here: Microsoft Office HTML and XML ReferenceCustomizing the look/style of the export documentSo far in this document we have described customization of the content in the Word exports. However most of the times you may want to customize the look of the export document to accommodate to your company standards.This is possible however you will have to play with customizing the original templates and may have to adjust some HTML/CSS files as well. The default export templates and CSS files are set up to produce the look which is closest to the original CodeBeamer web-page's look. This is what you may want to adjust. Customizing header/footer and using your company logoFor customizing header/footer and company logo simply make a copy of the original template documents, and in Word edit the header/footer and replace the texts, fields and the logo image as needed. An example screenshot shows this: Customizing styles in Word templateFirst when you try to customize the look of an element in the export document you should try to do it using Word's styling. For that open your customized copy of the template docx document, and adjust the styles there. That is done using Word's style dialogs. For example the following screenshots shows how to adjust the look of the "Heading 3" style in word. This is the style used when exporting the issue names and headings from CodeBeamer. So in this example we're changing the color of the Heading 3 to orange: The result when using this template will look like:
Now the question arise: how can I find which style to adjust in the template? This is can be found out by opening an exported_ document, and then:
The next screenshot shows this, and from that it turns out the HTML links are appearing using the Hyperlink style. This is the style should be adjusted in the template if you want a different look for these elements. Customizing look of html element using CSSWhile many elements in the export Word document is customizable in the export Word documents, several others are not. The Word export in CodeBeamer is primarily producing some HTML content -this is the HTML content you have learnt to customize previously in the document-, and that HTML content is merged into a the docx templates. When the export document is opened Word converts all embedded HTML (and CSS) contents to native Word content. During that conversion Word does a mapping between the exported HTML and the Word styles in the provided templates, however not all the HTML elements and CSS selectors get an appropriate style. Unfortunately it is not possible to assign any style to such HTML elements. So in this cases the best option is to adjust the CSS that is being used in export to get the desired look. Here is how to do this: Adjusting default HTML and CSS templatesIn CodeBeamer there are the following customizable Velocity templates available:
Both files are located in the $CB_HOME/tomcat/webapps/cb/config/templates/html directory. These files are plain text files, so for customizing them just open them in your favourite text editor. As soon as the changes saved they will be immediately applied without need of CodeBeamer restart. An example: if we want to change the look of the tables in our export result, like change the color and font-type then edit the mhtml-export-css.vm and add this to the end of it: table td { color: red !important; font-family: 'courier' !important; } As result table will appear as this in the export: Customizing HTML and CSS in the docx template documentsFrom the latest CodeBeamer 7.3.0.1 it is also possible to embed the customized HTML/CSS templates inside the template. This means that you can have a different HTML/CSS look in each docx template, instead of having only one customization globally. So instead of editing the "mhtml-decoration.vm" and "mhtml-export-css.vm" files now you can put the same customizations into the docx template. These customizations are stored in blue boxes with title "Custom HTML" and "Custom CSS" title appearing when you click on them. The customized content can be a Velocity template. If you want to only extend - and not replace- the default template then keep the ${defaultTemplate} variable/placeholder, which will be replaced by the original content from the "mhtml-decoration.vm" or "mhtml-export-css.vm". Following screenshot shows how to perform the same customization of the HTML tables inside the template: Advanced styling and HTML rewritingIf you can not make the styling correctly using plain CSS then you may need to apply an more advanced rewriting of the HTML output and add some extra Word styling. Such an advanced solution is described here: Advanced Word reporting: customizing Table-of-content and assigning Word style to wiki elementsCustomizing the proofing language of the export documentsIt is possible (since version 7.7) to customize the proofing-language of the documents. By default all languages are in English however that can be changed by creating a custom template and changing proofing language there as documented on Change Proofing Language in WordFor example if you want to export content in German, then:
|
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, furthermore helps us to 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. For more information about the cookies we use, please visit our Privacy Policy.Your preferences will apply to this website only.