Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

The WordTemplateHandler can also be installed in the Smartform as a button to generate a template if required. More information is here.

...

Class

Code Block
com.dooris.bpm.actionhandler.WordTemplateHandler

Parameter

Parameter

Default value

Description

Valid examples

template

Status
titlemandatory

This parameter is used to set the path to the template, so the ActionHandler can search for it in the resources folder.

It can be specified absolute or relative to the external file path in the loom.properties. In order to rename the generated PDF, the name of the template itself may contain process variables. 

Special case: Resolving process variables in the template name

Given the template, parameter has the following value: template=${SYS.PROCESSINSTANCE_NAME}_report.docx. In the target folder, the file will be searched accordingly.

  1. The WordTemplateHandler literally searches for the template ${SYS.PROCESSINSTANCE_NAME}_report.docx.

  2. If it is unable to find the respective document, the process variables SYS.PROCESSINSTANCE_NAME will be resolved in the document name.

  3. Only now, the WordTemplateHandler is looking for the template 8D-ProblemSolving_report.docx (8D-ProblemSolving is the resolved value of ${SYS.PROCESSINSTANCE_NAME}).

Info

In order to access ‘Resources’ section under the 'Administration' please see: Roles

${processInstanceId}_8D-report.docx

overwriteExisting

false

This parameter is used to decide if the documents should be overwritten if the process run by a loop. If the original template is needed, it should be false.

true

documentPrefix

The documentPrefix can be used so that created documents always have the specified value before the template name.

mydocumentprefix

pdf

false

If this parameter is set to false or is not given, the system replaces the variables in the template and creates a Word document, which is attached to the process. In order to create a PDF document instead of a Word document, this should be true.

true

removeEmptyTableRows

false

When the value is set to true, all table rows in the docx-template are cleared, if the variable in the first column is missing or empty. This can avoid unsightly blank rows in dynamic content (DOMRepeater).

true

interpretNummbersAsBoolean

false

It can be either true or false. If this value is set to true, process variables (which start with "bool") are changed like below: 

  • baa1 → true (In the document: true)

  • boolbaa1 → true (In the document: yes)

  • boolbaa1 → 1 (In the document: yes)

  • bobbb1 → false (In the document: false)

  • boolbbb1 → false (In the document: no)

  • boolbbb1 → 0 (In the document: no)

true

interpretBooleanAsHuman

false

This parameter is used to decide if the boolean variables (true and false) should be replaced with ‘yes and no'. Setting this variable to true will change boolean variables as 'yes and no'.

true

target

This parameter is used to determine the document name in the destination folder. This procedure is useful if the name of the created Word document should be different from the template name. The target parameter can contain process variables.

Suppose the user wanted to generate two reports in English and German. The Word template in the resource folder has the following name ${SYS.PROCESSINSTANCE_NAME}_report_${language}. With the target parameter, the name of the Word document can now be changed to e.g. target=XY-Report_DE. Therefore the user can create Word files with different names from the same Word template.

Note

File extension is not needed within the target parameter.

target=${processInstanceId}_${processInstanceName}_report

locale

"de"

With this parameter all system supported languages can be given in short form(e.g. en, de). This leads to, that all system-generated words (e.g. boolean Yes/No) are translated.

Example:

We have a brief use case to explain this ActionHandler.

...

Now the ActionHandler can be set up in the process flow. For each employee, a Word document containing the employee’s name and ID should be generated after process start. To achieve this, the WordTemplateHandler is implemented on the first task in the process model.

...

Parameter

Description

Example

template

Here, you provide the name of the Word template which was uploaded to the resources folder. When the process is started, the ActionHandler will find the template with this parameter and will create a new document with the information from the smartform. The document is stored in the “Documents” tab of the process instance.

${employee_name}.docx

Finally, a Smartform is required, which contains two input fields with the variables employee_name and employee_id.

...

The "onbuttonclick" attribute defines which functions the handler should execute.

Parameter

Description

Example

handler

Here, the ActionHandler is specified.

WordTemplateHandler

template

Here, the path to the WordTemplate is provided.

documentPrefix

Here, you can specify a prefix that should be added before the document name.

pdf

If the parameter is set to true , the document will be generated as a PDF document.

attach

Here, you can use the parameter true to specify whether the PDF document should be attached to the process in addition to the Word document.

open

Here, you can set the parameter to true to specify whether the document should be opened by the browser.

...

Document History

The document-history of a process instance can be reviewed via the system variable ${SYS:DOC_HISTORY}. The document history displays which documents of the instance have been attached, edited or deleted. With the WordTemplateHandler the user can save the document history to a Word or PDF document (s. screenshot).

...