DOCX Templates

Smartmate renders DOCX templates using a customized version of docxtemplater.

DOCX templates can be used by Smartmate to generate:

  • DOCX files

  • PDF files

The template should be created in Microsoft Word or other software that can save a docx file.

Using field values and variables

Fields and variables should be surrounded by single curly braces:

  • {myField}

  • {_vars.myVariable}

  • {relationshipField.anotherField}

  • {myTableField}

Additional Features

Open source features

Smartmate supports all the open source features of DOCX Templater:

  • Conditions

  • Loops

  • Sections

  • etc.

To learn more about them, make sure you head to the DOCX Templater documentation.

Images

Additionally, Smartmate supports displaying images. The syntax to add an image is:

{myImageField | asImage}              - shows the image in its original size
{myImageField | asImage | width:200}  - height is calculated maintaining aspect ratio
{myImageField | asImage | height:200} - width is calculated maintaining aspect ratio
{myImageField | asImage | width:200 | height:200} - it uses the defined width and height in pixels.
{myImage | asImage | type:'cm' | height:4.4 | width:8 } - it uses the defined width and height in cm.
{myImage | asImage | type:'%' | width:50} - width will be 50% of its original size