Embedding basic conditional statements into a DOCX template
In addition to embedding merge fields into a DOCX template, you can also embed simple control flow through if
statements by embedding a tag into your document in the following format:
{% if [boolean condition] %}
text and/or field
{% endif %}
For example, if you wanted to include the names.last
field only if there was an object called names
, you would embed the following tag:
{% if names %}
Last Name: {{names.last}}
{% endif %}
To see conditional statements in action, check out how to build a full-featured DOCX template.
Updated 10 months ago