A field is a placeholder within a template that controls the insertion or removal of content from the generated document.
Creating fields
A field is created just by typing.
Fields begin with a "less-than less-than" and finish with a "greater-than greater-than".
Matching fields with data
Inside the opening and closing delimiters, "<<" and ">>", should be a pattern of simple characters with no spaces, that Docmosis will match with a key in the data's key-value pairs.
The entire field will be replaced with the corresponding value during document generation process.
In the example template, the key "name" is provided in the data. This will be matched with the field <<name>> in the template, and the value "Julie", will appear in the generated document.
Formatting fields
Any formatting that is applied to the field, such as: bold; underline; italics; alignment; font-size/font-colour; etc., will be used to format the data when it is inserted in to the generated document.
In the example template, the second field <<name>>, is center aligned using a red italic 18pt font.The formatting is retained in the generated document.
TIP: It is actually the formatting of the last ">" character that determines the formatting used in the generated document. It usually makes sense to format the entire field so that the template is more representative of the output, but this trick can be handy as you will see below.
Making fields stand out in the template
It is possible to format part of a field without affecting how the generated document appears by applying styling to just the characters inside the delimiters "<<" and ">>".
Highlighting Fields
Applying highlighting to the characters inside a field is one way to make them visually distinct and easy to identify.
This can be beneficial if non-technical template authors are working on the templates.This approach reduces the likelihood of unintended edits or alterations to fields.
Matching formatting for opening and ending fields
Some fields, such as conditional sections, have matching start (<<cs_...>>) and end pairs(<<es_...>>).
In complex templates, these sections can span multiple pages. Applying distinct formatting, such as matching colors to the start and end pairs, makes it easier to visually connect these matching pairs in the template.