All Collections
Steps
Writer Steps
Word Merge to Word Writer Step
Word Merge to Word Writer Step

The Word Merge to Word Writer step is used to merge values to fields from any source to an existing Word template & create a new Word doc.

Praise Magidi avatar
Written by Praise Magidi
Updated over a week ago

Setting up to use a Word Merge to Word Writer step

There are two important flows that need to be created before adding and using a Word Merge to Word Writer step in a flow. The following are the flows that needs to be created:

Flow 1: Load Word Merge Template

This flow is used to load a Word Merge template that will be used to merge the fields. The image below shows an example of a Word file that contains merge tags as highlighted.

Illustrated below is a flow that is used to load the Word merge template file. The Group mapper step groups the records using a specified set of keys and returns the results as an array. The Calculator step creates a base64 string of the file. The Buffer destination step is used to store the base64 string.

The image below shows the input parameter that has been created for this flow. To create an input parameter, click the step shown in the image below.

The Name and Type are inputted as shown in the below image. Click on the Required checkbox to make it a required parameter. Save the parameter by clicking the green tick on the far right and then on the Save button.

The image below shows the code that is used in the calculator step to create the base64 string.

Flow 2: Test Merge Fields

This flow is used to test the merge template to see if the system is picking up the merge fields from the template. Illustrated below are the steps that are used in the flow. The Buffer Lookup is used to select the template from the buffer. The Buffer Lookup step is used to locate the template path.

The image below shows the Buffer Lookup step configuration where the lookup is based on the name of the file that is in the buffer and from the name that is being inputted as a parameter (image 2).

The Word Merge Fields Lookup mapper step is illustrated in the image below with the template path.

The image below shows the output of the Word Merge Fields Lookup Step which shows that the template fields are being referenced.

Flow 3: Flow Using The Word Merge to Word Writer Step

Illustrated in the below image is an example of a flow. The Record Generator is used as a source step. A Super Mapper maps the fields. A Buffer Lookup step references the merge template file to use (please refer to flow 2 for the config used in the Buffer Lookup step). The Calculator step sets the code used to link to the template step. The Word Merge to Word Writer Step document produces the merged Word document file which can be downloaded using the Run File destination step.

The Name and Type are inputted as shown in the below image. Click on the Required checkbox to make it a required parameter. Save the parameter by clicking the green tick on the far right and then on the Save button.

The Record Generator source step contains sample data shown in the image below. These are the fields that will be merged to ultimately create the Word document.

The source fields (fields on the left) and destination fields (fields on the right) are being mapped in the Super Mapper step as illustrated below.

A Calculator step is added after the Super Mapper step to return the mapped fields and the base64 Word template which is shown in the below image.

The outlook after the Calculator step is shown in the image below.

Adding the Word Merge to Word Writer Step

To add the Word Merge to Word Writer in a flow, follow the below instructions:

1. Click on the highlighted plus icon as shown in the below image.

2. The below page will appear. Select or search for a Writer step to pull out the source data. Click on the Writer tab and select Word Merge to Word as shown in the image below.

Configuring a Word Merge to Word Writer Step

Illustrated in the below image is the configuration that is available in the Word Merge to Word step.

Update Table of Contents checkbox – Forces a refresh of the Table of Contents following a merge.

Update Calculated Fields checkbox – Forces a refresh of Word calculated fields following a merge.

Clear Unmerged Fields checkbox – Clears unmerged fields following a merge.

Remove Empty Groups checkbox – Removes groups that have empty objects specified in the input mappings following a merge.

Remove Empty Paragraphs checkbox – Removes empty paragraphs following a merge.

Remove Empty Pages checkbox – Removes empty pages following a merge.

Strip Field Codes checkbox – Removes field codes from the merged document.

The Run File step is shown below. The File Type has been selected at Docx.

Using a Word Merge to Word Writer Step

Once the configuration is saved on the Word Merge to Word Writer step, follow the instructions below to execute the Flow 3:

1. Click the Execute Flow button shown in the image below:

2. Highlighted in the image below is the Template filename that was sent to the Buffer destination step in Flow 1 which is inputted in the Template parameter in Flow 3. Click the Create Run button to execute the run.

3. Click the download button in the Run File step to download the output file which is the new Word document after the Run has finished processing.

The image below shows the new Word document that was created with the values from the source that were merged to the Word template.

Did this answer your question?