Word: Create a Word Document

Use this action to dynamically create a customized Word document. This action can take a predefined template and create a document with new information each instance.

Use case

If a template Word file has {{first-name}} entered in it and a previous step in a Workflow (for example, a webform) gathers the individual’s first name as “Mary”, this step will create a new file based on the template and replace {{first-name}} in the template file with “Mary”.

  • Save time by creating custom Word documents based on dynamic values.
  • Reduce errors from doing a find-replace on an existing Word document.
  • Increase legal consistency by ensuring a standard template is used in all contracts or paperwork.

It can be helpful to combine this task with the PDF: Create PDF Document action.

How to configure this action

This action works by replacing {{field-name}} references in a template Word document with field values to create a new file. Both text and images can be replaced. The field values can be any length, but line breaks are ignored.

screen readers look here

Images are added in field reference format, such as {{my-image}}, but must have a % prefix, {{%my-image}} within the Word file. The {{%my-image}} reference must be placed in a text box in the Word template that is not part of the default layout on the slide.

This action supports .JPEG, .GIF, .BMP, and .PNG files. If an unsupported image file type is used, the action will complete without adding the image.

How to conditionally display text or images in a Word doc

Similar to conditional field references, you can conditionally populate parts of a Word doc based on if a field exists or not. This is like writing an IF/THEN statement.

For example, add the following text to a Word doc to define a condition for text to appear only if a field value DOES exist:

    {{#field-name}} This text will only display if field-name DOES exist. {{/field-name}}

If there is any data in the {{field-name}} field, the text This text will only display if field-name DOES exist will appear in the Word doc. If the field is empty, the text won’t appear.

Fields for this action

  • File Template

    • Reference the field where the file template is stored.
    • You can upload the file template in two ways: in an Instance Field or through a previous action. Use a reference to locate the file in either case.

      • If using an Instance Field, upload the file as a default and reference the field here.
      • If another person should upload the template, add a required file field in preceding task and reference the field here.
  • Format

    • Select the preferred format for the generated file, .DOCX or .TXT.
  • New file name

    • Enter a name for the new updated file, this is what the updated file will be named and saved as. This is useful for naming your file in a distinct way, such as adding a date, number, or ID.
    • If left blank, the new file will have the same name as the template file.

      💡Tip: The .DOCX or .TXT extension chosen above will be added to this name automatically and does not need to be included.

  • Keep unmatched fields

    • Select True or False from the drop down to choose how an unmatched field is handled if a reference field in a template file does not match with a field in the Workflow.

    • For example, if the field {{company-name}} is empty and has no value, the matching reference in the Word template {{company-name}} field would be considered unmatched.

      • Select True for any unmatched fields in the initial file template to be retained, showing {{field-name}} in the document
      • Select False or leave blank for any unmatched fields to be removed
  • Output field name

    • The name of the field in which the result should be saved. The step name is used by default. The step name is used by default.This is how you refer to the new file in an easy way.
    • 💡Tip: The New file name field is used to name the file, and the Output field name is where the new file is saved and referenced; this makes it easy to reference the output of this action when the file name is unique to each instance.

What will this output?

This action will produce a new file field with all updated data. The Output field name can be referenced as: {{output-field-name}} as chosen above.

Get help with a problem or question

If something’s not working as expected, or you’re looking for suggestions, check through the options below.

Why do the text or images I add not show up?

There are three things to check:

  1. Check to make sure all of the references inside the .docx file are in text boxes.
  2. Check to make sure references for images are added in with the prefix “%”, e.g., {{%my-images}}.
  3. Check that the references are in a text box in the .docx template that is not part of the default layout on the slide.

Here’s a small example of the way the references are added:

screen readers look here
Text shows up, but why do the images I add not show up?

If just the images are not working, you may be using an unsupported image type. This action supports .JPEG, .GIF, .BMP, and .PNG files.

If an unsupported image file type is used, the action will complete without adding the image.

As well, check to make sure references for images are added in with the prefix “%”, e.g., {{%my-images}}.