Create documents with Office Templating
The Office Templating task is powered by Nutrient Document Engine and allows for PDF and DOCX files to be created from request data using a DOCX file template that contains placeholders.
Advantages of using Office Templating
Office Templating offers several advantages over using the traditional PDF Generator task:
-
Simplified template creation — Design your document templates using any editor that supports saving files in DOCX format, avoiding the complexity of creating fillable PDFs, which often requires specialized third-party software.
-
Grid mapping — Office Templating allows you to seamlessly map entire grid data sets into your documents — functionality that’s not available with the traditional PDF Generator task.
-
Enhanced multi-option question handling — This task provides more flexible ways to represent multi-option questions within your documents.
-
Support for multiple output formats — With Office Templating, you can generate your documents as either PDF or DOCX files, giving you more options based on your needs.
How to generate a document
-
Create a DOCX template with placeholders in MS Word. The following image is an example of how this looks.
-
Design your template using any editor that can save DOCX files.
-
Use placeholders as unique identifiers wrapped in delimiters to mark where dynamic data will be inserted.
-
By default, placeholders use
{{
and}}
, but you can customize the delimiters. -
Placeholders must be alphanumeric, contain no spaces, and be unique within the document.
There are two types of placeholders that you can have in your template document:
-
Single placeholders — These represent one-to-one mappings of text-based data, e.g.
{{invoice_number}}
. -
Loop placeholder sets — These are used to insert repeating data like grid rows or multi-option question answers. They’re defined by an opening placeholder starting with
#
, a closing placeholder starting with/
, and placeholders in between.
Example:
{{#Loc_array}} {{add_label}} {{add_value}} {{/Loc_array}}
Here, Loc_array
is an array of data, and add_label
and add_value
are fields within each item.
-
Add the Office Templating task to your process. Select Configuration > Configure Task.
-
Configure the general settings.
-
Go to the General Settings tab.
-
In the DOCX document template field, upload your DOCX file template.
-
In the Output Format field, choose PDF or DOCX as your output.
-
Fill in the Start Delimiter and End Delimiter fields.
-
Under Prefills to add to Generated File Name, add the dynamic values to the Name of completed file field. You can add as many prefills as you want. The
.docx
or.pdf
extension will be added automatically based on the output format selected. -
Click Save.
-
Map your data fields.
-
Switch to the MAPPINGS tab.
-
All placeholders from your template will be automatically detected.
-
Map each placeholder to the corresponding data source in your system.
Mapping questions
To map text-based questions — e.g. short text, calendar, search box — map the single placeholders to your desired data source. The image below shows an example of a text-based question mapping.
To map multi-option questions — e.g. checkboxes, radio buttons, select list — follow the instructions below.
Checkbox mapping
-
Map the loop placeholder from your template to the checkbox question in your form. For example, if your template has:
{{#Loc_array}} {{add_label}} {{add_value}} {{/Loc_array}}
Map Loc_array
to your checkbox question.
-
You can choose whether to display All options (both selected and unselected) or Only Selected options in your output. Make your choice and click Save.
-
Click the icon to expand additional settings.
-
For the placeholders inside the loop:
-
Map
add_label
to the option label (e.g. the checkbox text). -
Map
add_value
to the selection status (whether the option is checked).
-
-
Under Represented As, choose how you want the checkbox to appear. Then click Save.
Example
Here’s a checkbox shown with all options vs. only selected options in a checkmark/cross format.
Radio button mapping
-
Mapping a radio button question is similar to a checkbox, but it only allows one selected option.
-
Use a loop placeholder as you would with a checkbox, but expect only a single choice to be mapped.
Example
Select list mapping
-
To display the selected value as text, map it using a single placeholder just like a text-based question.
-
To show graphical representations (similar to checkboxes or radio buttons), define a loop placeholder and map it like the checkbox or radio button examples.
Example
Here’s how a select list is mapped with labels only.
How to map a grid
-
Create a loop placeholder named
items
in your DOCX template, enclosing all the columns you want to map. Each placeholder inside corresponds to a grid column. For example:
Qty. | Item# | Description | Unit price | Line total |
---|---|---|---|---|
{{#items}}{{quantity}} | {{number}} | {{description}} | {{price}} | {{total}}{{/items}} |
-
Map the
items
placeholder to the grid question in your form. Then click Save.
-
Map each individual placeholder (
quantity
,number
,description
,price
,total
) to the corresponding grid columns in your form.
For currency fields like price
or total
, make sure to specify the appropriate currency format.
How to map a footer total in a grid
To map a footer value such as a total:
-
Add a new parameter for the total.
-
Select the grid question in the Field dropdown.
-
For Which Options, choose Specific Cell.
-
Set Row to footer.
-
Set Column to the column containing the total (e.g. Line Total).
Example of a complete grid mapping
Conclusion
Office Templating is a powerful and flexible way to automate your document creation process, enabling you to generate highly customized DOCX or PDF files effortlessly. By leveraging placeholders and advanced mapping options — including grid data and footer totals — you can streamline your workflows and produce professional documents that perfectly fit your business needs.
If you’re interested in adding this premium feature to your license or want to learn more about how Office Templating can transform your document generation, don’t hesitate to reach out to our Customer Success team.