Skip to main content
How to save sub list values to word template

Setting up a Word template with a repeating table for sub lists.

Updated over a month ago

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:

    • Right-click the table, go to Table Properties, and set the Alt Text Title to match the sub list name in your workflow.

    • Add a Repeating Section Content Control for the table rows.

  • 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:

    1. In your workflow, insert a Generate Document action. Refer to Generate document action.

    2. Select your Word template with the configured table.

  • Map Sub List to the Table:

    1. Click on the Set Variables button or Settings to open the variable mapping window.

    2. Find the table in the Content Controls list (marked as “Table” under Control Type).

    3. Click the dropdown to map the sub list variable to the table.

  • Map Sub List Fields to Table Columns:

    1. Click Select Fields to open the field mapping window.

    2. 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.

    3. 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:

    1. Specify a name for the generated document (e.g., “Invoice”).

    2. Choose a save location, such as Variables, Attachments, or another destination in your workflow.


3. Test the Configuration

  1. Run the workflow with sample data to ensure sub list values populate the Word template table correctly.

  2. Open the generated document and verify that the sub list data is displayed accurately in the table.

Did this answer your question?