Prev Next

Adding Fragments to a Document Template

A Template Fragment is a template that can be used as a smaller sub-section of a normal document template. You do not generate a report from a Template Fragment on its own; instead you use a normal template that includes references to one or more Template Fragments.

Fragments can be called into these sections in the template:

  • Package
  • Element
  • Attribute
  • Method

They cannot be called into other sections. When generating a document report, as the report generator processes each section in the template, if it encounters a reference to a Template Fragment it will process that Fragment, inserting its output in the appropriate location of the generated report.

Access

Ribbon

Publish > Tools > Document Templates

Keyboard Shortcuts

F8 > Templates

Incorporating Template Fragments into a Document Template

Step

Action

See also

1

Create the Template Fragment(s) to be included in your document template, or identify system Template Fragments to use.

Creating a Template Fragment

2

Create a new document template, or open an existing template in the document editor.

Document Templates

3

In the 'Sections' panel, select the checkbox against each section that will refer to the Template Fragment(s) ('Package', 'Element', 'Attribute' or 'Method').

Setting Sections for Reporting

4

In the 'Content' panel, at the appropriate point within one of these sections, right-click and select the 'Insert Template' option.

The 'Select Template' dialog displays.

5

Click on the drop-down arrow and select the Template Fragment to insert.

6

Click on the OK button.

The tag {Template - <template name>} is inserted at the current cursor position.

7

Repeat steps 4 to 6 for each Fragment you want to insert into the document template.

Complete any other work you need to do on the template, then save it and use it to run reports.

Editing or Switching Template Fragments

Right-click on the red Template tag > <required option>.

Option

Action

See also

View / Edit Fragment

Opens the selected Template Fragment in another instance of the Document Template editor.

If you have selected a System Fragment, you can view the Fragment but not edit it. If you have selected a Model (user-created) Fragment, you can edit the Fragment.

Design Custom Document Templates

Override Fragment

(Option available for a selected System Fragment)

Opens another instance of the Document Template Editor, where the System Fragment is duplicated as a Model (user created) Fragment with the same name. You can edit this Fragment and save it, and the original template will apply that new Model fragment instead.

Switch Fragment

Displays the 'Select Template' dialog; click on the drop-down arrow and select a different Template Fragment.

Notes

  • You can also add a Template Fragment to a document template by locating the Fragment in the Document Generation folder in the Resources window and dragging the Fragment into the Document Editor; Template Fragments are held in the Fragments folders within the System Templates and User Templates folders
  • To delete a Template Fragment from a Template, drag the cursor along the inserted name to highlight it, then press Delete
  • It is possible to embed a Template Fragment within another Fragment; however, this will slow down report generation

Learn more