Description:
Replace the Word document with variables & globals
Inputs
- templateName – Choose the desired Report Template
- outputFileName - Name of the output file
- varName - Variable/Global to hold the output file path
Returns
- True – step executed successfully
- False – step failed to execute
Usage:

Example:
Let’s build and execute the wordDocReplacerDef example.
- Create a new definition called “wordDocReplacerDef”
- Select the definition and click the “design” button
- Drag an “updateVariablesWithSQL” and “wordDocReplacer” and connect with the Start step
- Connect the dots between the steps as shown in the Usage above
- Define a few variables/globals to store the SQL fetch result and Output document file path after execution

- Click the "updateVariablesWithSQL" step to configure its "Settings" properties. Give the step a name. Select the Connection String from the drop-down list. In the text area, provide the SQL Select statement. Click the button to assign the SQL column values to the process variables/globals.

- A popup window is displayed for configuration. Click on the Add Row button to insert a blank row. As shown below, provide the SQL column names and map them to the process variables/globals. Click on the Save button to confirm the configuration.
- Open Microsoft Word and prepare a DOCX template file, as shown below. The template file includes the process variables/globals, which are replaced with actual values when the document is created during the process instance. Provide a name and save the template DOCX file in your local folder.

- Click on the "wordDocReplacer" step to configure its "Settings" properties. Give the step a name. Click on the file icon and upload the DOCX report template file. Provide the variable/global to store the output file path.

- Click on the "wordDocReplacer" step to configure its "Advanced" properties. Provide a name for the output DOCX file. Click on the Save button to confirm the configuration.

- Save the process definition, create a new process instance, and execute. The process instance is completed without any human intervention.

- Render the process instance. Click on the “wordDocReplacer” process step to view the properties.

- The step should generate a DOCX file using the variables/global values provided during the run time. The output variable holds the file name path, as shown below.

- Navigate to the Status—File Manager—OutputDocs folder. Right-click the DOC file to search and download it.

- The word document is replaced with the variable values during the process instance.
