Add the content controls
Content controls are placeholders for document data in Word templates. When the report is run, the XML model (custom XML) inside the Word template is merged with data retrieved from WorkZone Content Server with help of the OData queries in the Report JSON file. The data from custom XML is inserted in the content control place holders, according to the binding defined inside content controls.
Place the content controls where you want the document data displayed in the template. Different types of content controls can be selected, but, in most cases, it will be sufficient to select Plain text.
Another often used type of content controls is the Date Picker. The Date Picker content control enables you to define the date format directly in content control properties, and it can therefore contain data in date format.
Note: You must be able to access the Developer tab in order to define and place content controls in the Word template.
- In the Word template, click the Developer tab > XML Mapping Pane to open the XML Mapping pane.
- In the XML Mapping pane, select the XML model you want to create content controls for.
- In the Word template, place the mouse cursor where you want the content control to be displayed.
- In the tree view in the XML Mapping pane, right-click the data element you want displayed in the template, select Insert Content Control, and then select the element type, typically Plain text. The content control will be placed at the mouse cursor position.
Creating content controls
In this example, the Records XML model located at https://schemas.workzone.dk/Odata has been selected.
When inserting the content control in the template, the records in the Record XML model and the Plain text option have been selected.
Content control properties
Define titles and access rights to the content controls in a document by directly editing the content control properties.
To set up the content control properties, select the content control in the report template, and either right-click, and select Properties, or click Properties in the Developer tab > Controls group.
Repeating content controls
A repeating content control repeats all content in the content control, including other content controls.
If you want to display a running list of elements attached to a main record, for example, display main document metadata in the upper half of the reports and display any supplementary documents attached to the main document in the lower half of the report, you must use repeating content controls to contain the data content controls.
Repeating content controls can also contain and repeat other content controls, for example, inner and outer lists. See nested repeating content controls below.
- In the Word template, create a table, and place the table in the template.
- Select the table row that is to contain the repeating content control.
- In theDeveloper tab > Controls group, select the Repeating Section Content Control button to insert a repeating content control.
You can also right-click the data element in the XML Mapping pane and select the Repeating to insert a repeating content control. - Place the mouse cursor in the table cell where you want to insert a content control.
- In the tree view in the XML Mapping pane, right-click the data element you want displayed, select Insert Content Control, and then select the element type, typically Plain text. The content control will be placed at the mouse cursor position.
- Repeat steps 4 and 5 for each data content control you want represented in the table.
Tables should be used to contain repeating content controls in order to facilitate PDF conversion, but you can place repeating content controls directly in the report template if you want.
Simple repeating content controls in a table row
In this example, a table has been created in the report template and made into a repeating section content control.
You can display content controls with start and end tags by selecting Start/End tag in the Show as field in the Content Controls Properties form.
The RecordNo, RecordKey and Title content controls have been added to selected repeating table cells, enabling the table to create new rows for each new attached document.
If a main document has at least one supplementary document, the number of supplementary documents will be displayed in brackets after the title of the main document.
Nested repeating content controls
If you want to create a report with nested data - for example, create a list of supplementary documents for each main document - place the repeating control controls for the supplementary document inside the repeating content controls for the main document. This corresponds to nested loops in programming, where the supplementary document repeating content control is the inner loop and the main document repeating content control is the outer loop.
For example
- Main Document A
- List of supplementary documents for Document A
- Main Document B
- List of supplementary documents for Document B
- Main Document C
- List of supplementary documents for Document C
- Main Document D
- List of supplementary documents for Document D
Nested repeating content controls
In the example below, the red content controls are repeating content controls for the main document data, and the blue content controls are repeating content controls for the supplementary document data.
Placeholder text in content controls
If the content control does not contain data, the placeholder text for the content control will still be displayed in the report when the report is run.
You can hide content control placeholder text for content controls that contain no data by adding a space after the content control end tag in the report template and then pressing backspace to delete the space. The content control tags will change appearance.
Placeholder is text not displayed when data does not exist
In this example, the FileNo and Title placeholder text for the content controls will be displayed in the report even when there is no data to display.
After the trailing space has been removed, the FileNo and Title content controls will not display placeholder text when there is no data to display, and they will change appearance:
Tip: Define a title and/or tag for the content control in the Content Control Properties form to improve your overview of the relations between repeating elements and their corresponding entities.