A template file is a Microsoft Word document that contains the layout of the OpenXML Word report. You can define the layout of the report by adding controls, such as labels, text boxes, check boxes, list boxes, and so on. A template file can contain both tabular data and non-tabular data.
A sample template file delivered for the transmittals object is shown in the following image:
1 |
Labels for non-tabular data. |
2 |
Labels for tabular data. |
3 |
Static text. |
The following procedure describes how to create and configure a template file.
-
Open Microsoft Word.
-
Click the DEVELOPER menu to switch to the Developer mode.
If the DEVELOPER menu is not visible, click File > Options > Customize Ribbon to enable the Developer mode.
-
To add controls, such as a label, text box, and so on, to the template file, click the appropriate control in the ribbon, as shown below:
-
After adding the required controls, select a control, and click Properties in the ribbon. The Content Control Properties dialog box appears.
-
Type a Title and Tag for a control. Each control must have a unique tag. This tag is linked in the control file to the view definition and property that contains the data for the control.
After defining all the tags, click Design View on the ribbon to view all the tags.
-
Specify other properties for controls, as needed.
-
Save the template file.
A sample Design View for the template file delivered for transmittals is shown in the following image:
1 |
Tags for non-tabular data |
2 |
Tags for tabular data |
-
When specifying a tag name for a date control in the Content Control Properties dialog box, always begin the tag name with “dat”, for example, datCurrentdate.
-
When specifying a tag name for a check box in the Content Control Properties dialog box, always begin the tag with “chk”, for example, chkSpaces.