Platforms
Frameworks
Languages
Platform Specifics
File format support
This is a collection of advanced features for office templates. See here for an overview of basic features and the data model.
The default tag delimiters are {{
and }}
. If you wish to use a different set of delimiters, you can use the functionsOfficeToPDFOptions#SetTemplateLeftDelimiter
OfficeToPDFOptions#SetTemplateRightDelimiter
If a tag's key cannot be located in the data JSON, it will silently be removed from the document. If strict mode is enabled it will instead result in an error. To enable strict mode, use the functionOfficeToPDFOptions#SetTemplateStrictMode
By default, strict mode is disabled.
In both the cases where a loop is given a json value of []
and a conditional is given a json value of false
, the body is entirely removed. If the loop/conditional construct was the only thing in it's parent element, it will also remove the parent element.
For example, if an empty loop is the only text in a paragraph, the paragraph will be removed and the proceeding content will be moved up. Another example is an empty row loop, the row itself will be removed.
If this behavior is not desired, a possible workaround is to add a single space character outside of the loop/conditional.
By default, keys are "unspecified scope". Their value is taken dynamically from the most-specific (tightest) loop that contains that key.
For example, a loop{{loop arr}} {{key}} {{endloop}}
with the JSON data
Will result in *local *global
.
In order to restrict a template tag to use values from a specific loop, you can specify a scope: {{arr::key}}
. The top-level global scope is {{::key}}
and in a nested loop you can have a nested scope: {{outer::inner::key}}
.`
This is an alternative to table row loops, which should be preferred in most cases.
Table row insertion values are JSON objects, and can only serve as the value for a template key that is in the first row of a table. They have the following required properties:
insert_rows
: [array of arrays] An array of rows, representing the content to be added. If a table had 3 columns and you wanted to insert two rows within it, insert_rows
would expect an array containing two arrays of three items each. The items within the three-member row arrays would be any allowed template value, such as text or an image.Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales