Powerful Document Generation

Last published at: July 9th, 2021

FlowWright now provides a very powerful document generation step that's built based on Aspose technology. You are now able to generate simple to complex documents using this new step within FlowWright; its very easy to configure and use. Here are the steps: 

Just drag the step from the Workflow designer toolbox and start using the step. The step has the following properties:

The two main required properties are the "Chose report template" and "Configure data sources". Report template defines what to display within the document and the configured data sources lets you bring data from different sources to generate the document. You can select an existing report template (Word document) or upload a new report template, whatever you prefer. 

The report template file (.DOC format) can be used;

  • to do variable replacements either in plain text or HTML
  • fill custom fields or variables in HTML
  • bind the data from the data source

The contents of a sample report template file is shown below. The variables are defined in a specific format and this can be placed along with the other document content. Like a "mail-merge" feature, the Word Document generator step shall replace the variables or custom fields either in plain text or HTML. A "for loop" Aspose syntax is used to display all the names and emails from the data source "ds.Users". For a list of all supported template functions, please refer to Aspose documentation Template Syntax, for enumeration methods, click here.

Next is to configure a data source, any number of data sources can be configured. Here's an example of the data source used by the above template:

Based on the above graphic, you can see there are 3 data sources being defined, but only one used on the template. Step properties also have four different step properties for providing variables for document path storage, the following paths will be stored:

Paths stored

  • generated physical document path for the Word document
  • generated physical document path for the PDF document
  • generated virtual document path for the Word document
  • generated virtual document path for the PDF document

Next step is to use the step in a Workflow definition to generate a document.

After creating an instance and executing, the following Word document is generated.

Above is a document generated using a simple template, more complex documents can be generated using rules, logic and complex expressions. Expression also support Microsoft .Net Language Integrated Query(LINQ) technology.

Once these documents are generated, the process can extended with other out-of-the-box steps to route the document to other users for review and approval, or email generated documents to customers.