/
Example of Using Variables in DOCX Template

Example of Using Variables in DOCX Template

This section presents sample logic and templates showing how variables can be used. For a general description how to create a DOCX template, see About Publishing to DOC or PDF.

The following variables are used in the sample:

  • Simple variable

  • Repeated variables

  • Repeated table row

  • Variables used for condition statement (e.g., block)

  • Else if statement

You can also insert a complex XML with formatting, as shown in this demo: https://docxtemplater.com/demo/#xml-insertion

Sample element code for repeated variables (returns an array of maps)
def arrayMaps = []; arrayMaps << [name:'Amy', price: 54] arrayMaps << [name:'Amy2', price: 154] arrayMaps << [name:'Amy3', price: 255] arrayMaps << [name:'Amy4', price: 367] return arrayMaps

Download the sample logic and template.

Related content

Build New DOCX Template
Build New DOCX Template
More like this
Set Up Publishing Templates
Set Up Publishing Templates
Read with this
Example of Using Variables in DOCX Template
Example of Using Variables in DOCX Template
More like this
About Publishing to DOC or PDF
About Publishing to DOC or PDF
Read with this
Build New DOCX Template
Build New DOCX Template
More like this
Templates for DocuSign
Templates for DocuSign
Read with this

Found an issue in documentation? Write to us.

 
Pricefx version 14.0