wordDocGenerator Step
Description:
This step generates documents in Word or PDF format using Word templates and provides document access security. These Word templates may contain 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. 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 pop-up window appears for configuration. 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 value that contains 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, PDF physical path, and virtual file path information. 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 rendered below. Here, you configure the data source, table relations, and the 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 sub-folder of “DocReports”.

- Click the icon to upload the Word document template from the local folder. The uploaded file will replace the previous template. You can verify the file's correctness by clicking the template file hyperlink to download it. Click the 'Remove Template' to permanently remove the existing template from the document path on the server. Click the Close button 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 is displayed for configuration. Click the Add (+) button to insert an empty row. Select the DB connection from the drop-down list. Provide the SQL Select query. Provide the data source name. Click the Add button to insert multiple data sources. Click the Save button. Note: The data source names are unique.

- Click the “WordDocGenerator” step to configure its “Optional” properties. Click the button to configure the table relations. A pop-up window is displayed for configuration. Click the Add Row (+) button to insert an empty row. Provide the parent and child data source names and column names. Click the Save button. You may 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 pop-up window appears for configuration. An alert message indicates “no prior configuration” the first time. 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 the list of User GUID values. You may also include the app roles from the drop-down list and/or provide a variable or global reference containing the 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 PDF and update the physical and virtual file paths of variables or globals.

- You may 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.