In document generation workflows, it is often necessary to use tables to represent sub lists, such as line items in an invoice or a list of tasks in a project. Microsoft Word allows you to set up repeating sections in a table to handle this kind of data dynamically, so each item in the sub list generates a new row in the table. This guide will walk you through setting up a Word template with a repeating table for sub-lists, using Developer Mode, and configuring the Generate Document action for variable mapping.
Business Scenarios
Saving sub list values to a Word template is useful in many scenarios, such as:
Invoices and Purchase Orders: Automatically populate item details, quantities, and prices into an invoice or purchase order template.
Project Reports: Fill out tables in project reports with team member details, tasks, and progress updates.
Event Planning Documents: List event schedules, attendee details, or resource requirements dynamically.
HR Documents: Create detailed reports, such as training session summaries or performance reviews, with employee data.
For these scenarios, sub list values can be dynamically mapped to Word templates. Here’s how to configure this.
Prerequisites
To save sub list values to a Word template, you need:
1. A Sub List in Your Approval form
The sub list is part of your approval form and contains a collection of related data (e.g., items in an invoice or tasks in a project).
Ensure that the sub list is defined in your workflow with fields matching the table columns in your Word template (e.g., Contract Name).
2. A Word Template with a Table
Create a Word template in Developer Mode, including a table to receive the sub list data.
Set up the Table:
Insert a table and configure it to accept sub list data dynamically.Name Your Table Content Control:
Add Content Controls to Columns:
For each column in the row:Add a Plain Text Content Control or another appropriate control.
Set the Title and Tag to match the corresponding sub list field (e.g., “Contract Name” for Contract Name).
Steps to Save Sub List Values to a Word Template
1. Configure the Workflow
Add the Generate Document Action:
In your workflow, insert a Generate Document action. Refer to Generate document action.
Select your Word template with the configured table.
Map Sub List to the Table:
Map Sub List Fields to Table Columns:
Click Select Fields to open the field mapping window.
In the Select fields window, there are three columns:
In the Content Control column, displays all the content controls in the table(e.g., Contract Name, Contract ID).Check the box next to each content control you want to populate.
In the Control Type column, displays the control type (e.g., Text, Picture).
In the Value column, for each content control in the word template, map it to the appropriate variable in your workflow displays all the content controls in the table (e.g., Contract Name, Contract ID).Check the box next to each content control you want to populate.
Click the Value dropdown to map each sub list field (e.g., Contract Name, Contract Address) to the corresponding table column.
Other fields mapping can refer to How to save workflow variables to word template.
2. Configure Output Options
Choose Generation Type:
Single PDF File: Convert the output to PDF format.
Original File Types: Keep the output as a Word document.
Set Output File Name and Save Location:
Specify a name for the generated document (e.g., “Invoice”).
Choose a save location, such as Variables, Attachments, or another destination in your workflow.