wordDocGenerator Step
Description:
This step generates documents in Word or PDF format using Word templates and provides document-level security. The document is stored in the file system or the DMS File Storage Folder. The Word templates may include reporting commands specified by the Aspose reporting engine: https://docs.aspose.com/display/wordsnet/Template+Syntax
https://docs.aspose.com/display/wordsnet/Appendix+A.+Enumeration+Extension+Methods
Inputs
- chooseReportTemplate – Choose the desired Report Template
- configureDataSources – Configure the Data Source
- tableRelations - configure the parent and child dataset relations
- documentSecurityConfig - configure the document security
- docPhysicalPath – specifies the .docx Physical File Path for the output
- pdfPhysicalPath - specifies the .pdf Physical File Path for the output
- docVirtualPath- - specifies the .docx Virtual File Path for the output
- pdfVirtualPath- - specifies the .pdf Virtual File Path for the output
- generateOnlyPDF - select Yes or No to generateOnlyPDF
- fileName - PDF / DOC file name for the output
- folderName - provide the folder name to store the generated document
Returns
- True – step executed successfully
- False – step failed to execute
Usage:

Example:
Let’s build and execute the “WordDocGeneratorDef” example.
- Create a new process definition named “WordDocGeneratorDef" and open it in designer mode.
- Drag a “UpdateVariable, UpdateGlobals, and WordDocGenerator” step to the canvas.
- Connect the dots between the “Start” and other steps, as shown above.
- Define a few variables or globals to store the User ID, App Role names, and output file paths.
- Click the “UpdateVariable” step to configure its “Required” properties. Provide a name for the step. Click the “Save” button. Note: Click the "AI Predict" button to have Copilot add new process steps that match your process description.

- Click the “UpdateVariable” step to configure its “Optional” properties. Provide a variable reference to store a single user GUID. Select “No” if the variable value does not contain a C# expression. Click the “Update Multiple” button to configure multiple user references. Click the “Save” button. Note: In this example, the output document shall be granted access to a variable value containing a User ID.

- Click the “UpdateGlobal” step to configure its “Required” properties. Provide a name for the step, then click the “Save” button. Note: Click the "AI Predict" button to have Copilot add new process steps that match your process description.

- Click the “UpdateGlobal” step to configure its “Optional” properties. Click the “Update Multiple” button to configure multiple global values. A configuration pop-up window appears. Click the Add Row (+) button to insert an empty row. Enter a global variable reference and its value. Click the “Save” button. You may add multiple global values by using the Add Row button. Note: In this example, the output document shall be granted access to a global variable containing an application role name.

- Click the “WordDocGenerator” step to configure its “Required” properties. Provide a name for the step. Click the file selector icon, then select the MS Word document template from the local folder. The file is uploaded to the application server path. Provide variable or global references to store the DOCX and PDF physical paths and the virtual file path. Click the “Save” button. Note: Click the "AI Predict" button for the Copilot to add new process steps that match your process description.

- Click the “WordDocGenerator” step to configure its “Optional” properties. The UI is displayed below. Here, configure the data source, table relations, and document access security. Select “No” to generate both DOCX and PDF files. Provide a custom file name for the document. Provide the new folder name to store the generated document. Click the “Save” button. Note: The new folder should be a subfolder of “DocReports”.

- Click the icon to upload the Word document template from the local folder. The uploaded file will replace the previous template. Verify the file's correctness by clicking the template file hyperlink to download it. Click “Remove Template” to permanently remove the existing template from the document path on the server. Click “Close” to continue the configuration.

- Click the “WordDocGenerator” step to configure its “Optional” properties. Click the button to configure the data source. A pop-up window opens for configuration. Click the Add (+) button to insert an empty row. Select the DB connection from the drop-down list. Enter the SQL Select query. Enter the data source name. Click the “Add” button to add multiple data sources. Click the “Save” button. Note: Data source names are unique.

- Click the “WordDocGenerator” step to configure its “Optional” properties. Click the button to configure table relations. A pop-up window opens for configuration. Click the Add Row (+) button to insert an empty row. Enter the parent and child data source and column names. Click the “Save” button. Insert multiple table relations using the “Add” button.

- Click the “WordDocGenerator” step to configure its “Optional” properties. Click the button to configure document security. A configuration pop-up window appears. The first time, an alert message indicates “no prior configuration.” Note: If no security permissions are configured, the default permissions are applied to the Admin and the process initiator user.

- Provide a future expiry date by selecting the appropriate date value as shown below.

- The custom future expiry date can be selected as shown below.

- In this example, Document Security is configured to expire on a custom future date. Select the access privileges by clicking the “All Users” or “Users/Roles” button. Selecting “All Users” makes the document URL available to all active users until the expiry date.

- By selecting “Users/Roles”, the document URL is accessible to specific active users until the expiry date. Note: Select the checkbox to enable document access for FlowWright Administrators and Process Initiators. Select users from the drop-down list and/or provide a variable or global reference containing a list of User GUID values. Also include the app roles from the drop-down list and/or provide a variable or global reference containing a list of application user roles. Click the “Save” button.

- The report template format is shown below.

- Confirm the changes. Save the process definition, create a process instance, and execute it. The step should generate a Word document or a PDF and update the physical and virtual file paths for variables or globals.

- Note: The step should generate a Word document or PDF, store it in the DMS folder, and update the virtual file paths for variables or globals. The document shall be stored in the DMS folder if the “DMS File Storage Folder” is configured in the “Start” step.

- Use an Email process step to share the file paths as URLs. Note: The document security configuration now controls file access. The generated PDF file is saved with the file name configured above. The example content is shown below.

Definition Sample:
You may download the sample definition(s) from the link here and later import them (drag-and-drop) to your FlowWright Process Definition (XML file) or Form Definition (HTML file) page.
Note: Please verify and complete any missing configuration steps after import, such as file path references and database connections. Then, save the definition to confirm the changes.
Click here to download the sample files.