Generate Doc

Use this feature to Generate documents as Word or PDF using word templates

Last published at: February 19th, 2025

wordDocGenerator Step

Description:

This step generates documents in Word or PDF format using Word templates and provides a document access security feature. 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
  • tableRelations - configure the parent and child dataset relations
  • docVirtualPath- - specifies the .docx Virtual File Path for the output
  • pdfVirtualPath- - specifies the .pdf Virtual File Path for the output
  • fileName - PDF / DOC file name for the output
 

 

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 called “WordDocGeneratorDef" and open the definition 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 for the Copilot to add new process steps that match your process description. 

 

  • Click the “UpdateVariable” step to configure its “Optional” properties. Provide a variable reference to hold a single user GUID value. 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 for the Copilot to 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 is displayed for configuration. Click the Add Row (+) button to insert an empty row. Provide a global variable reference and the 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 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 and select the MS Word document template file from the local folder. The file is uploaded to the application server path. Provide the 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. Provide a custom file name for the document. Click the Save button. 

 

  • 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 the document security. A pop-up window is displayed for configuration. An alert message indicates “no prior configuration” for the first time. 

 

  • Provide an expiry future date by selecting the appropriate date value as shown below.  

 

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

 

  • In this example, the Document Security is configured to expire by a custom future date. Select the access privileges by clicking the “All Users” or “Users/Roles” button. By selecting “All Users”, the document URL is available for access by all active users till the expiry date.     

 

  • By selecting “Users/Roles”, the document URL is available for access by specific active users till the expiry date. Note: Select the checkbox to enable the document access for FlowWright Administrators and Process Initiators. Select the users from the drop-down list and/or provide a variable or global reference that contains 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 that consists of 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 then execute it. The step should generate a Word document or PDF file and update the physical and virtual file paths of variables or globals. You may use an Email process step to share the URL file paths. Note: The document security configuration now controls the file access.  
  • The generated PDF file is saved with the file name configured above. The content for the example 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 the process steps for any missing configurations, such as file path references and database connections, after import. Then, save the definition to confirm the changes. 

Click here to download the sample files.