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.

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.

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.