User Tools

Site Tools


Plugin installed incorrectly. Rename plugin directory 'swiftmail.backup' to 'swiftmail'.
en:software:tim:actionhandler:wordtemplatehandler

This is an old revision of the document!


WordTemplateHandler

This handler describe a Word document with variables taken from smartform variables.

The parameter “overwriteExisting” tells if an existing template can be overwritten (true) or a new template should be created.

In order for the handler to be able to create PDFs, the Open Office Converters must be installed.
From Tim Version 3.7 on, the variables from the VariablesHelper may be used.

The images attached to the instance may be placed into the Word document. For this, special variables must be present in the template.
Individual images may be entered: $img{Image.jpg} ← Exact name of the entered imaged
Alternatively, all of the images attached to the instance may be entered: $img{addAllImages}

The WordTemplateHandler may also be built into the Smartform as a button, on order to generate a Template if needed. More on this subject is found here

Action Class

com.dooris.bpm.actionhandler.WordTemplateHandler



Event Type

any

Action Name

any

Mandatory Fields

-


Parameter

template

The path to the template is entered here. It may be entered as an absolute or relative to the Externalfilepath in the loom.properties.

In order to rename the generated PDF, the name of the template itself may contain process variables. (see Example)
Special case: Resolving process variables in the document 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 looks for the template ${SYS.PROCESSINSTANCE_NAME}_report.docx.
  2. If it is unabled to find the respective document, the process variables in the document name will be resolved.
  3. Only now the wordTemplateHandler is looking for the template 8D-ProblemSolving_report.docx (8D-ProblemSolving is the resolved value of SYS.PROCESSINSTANCE_NAME).
This procedure strongly increases the performance of the wordTemplateHandler


overwriteExisting (optional)

This may be either true or false. If the name is set to true, TIM overwrites the existing PDFs if the process runs again through a loop. If the PDF is still needed, the value must be set to false.

This value is set to false by default


documentPrefix

The documentPrefix can be used to attach the entered value to the template name of of the PDF as a prefix.

pdf (optional)

This value must first be set to true in order to TIM to generate a PDF. If the value is set to false or nothing is entered, TIM replaces the variables in the template and generates a Word file, which is then attached to the process.


interpretNummbersAsBoolean

If this value is not set by the user, the default is false. If the value is set to true, process variables (with names beginning with “bool”) are transformed as follows:

Variable name Value Result in PDF
baa1 true true
boolbaa1 true ja
boolbaa1 1 ja
boolbbb1 false nein
bobbb1 0 0
boolbbb1 0 nein


interpretBooleanAsHuman

This is set to false by default. If this value is set to true, the values of all of the variables marked as true or false are replaced with the values yes or no, respectively.

Available from Version 3.5 on!


target

With the target parameter the document name can be determined that is attached to the process instance in TIM. The document name can contain process variables.

Important: no file extension is needed within the target parameter

The document belonging to the instance of the 8D Problem Solving process is e.g. saved as 1467_8D-ProblemSolving_report.docx.

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



Example


In this example, a PDF is attached after the activation of the wordTemplateHandler. It is composed as follows:

Änderungsabwicklung_E1_tim_123_test_1.pdf

Integrating the Wordtemplatehandler into the Smartform

The Wordtemplatehandler can be integrated into the smartform as a link, a button, or an image so that participants can create a template at any time. For this, the following code must be integrated into the smartform:

<button type="button" onbuttonclick="generateFileFromTemplate([{handler:'WordTemplateHandler',template:'pfad/zumTemplate.docx',pdf:false,attach:false,open:true,documentPrefix:'Prefix'}])">

Further information can be found on this page.


Potential problems

en/software/tim/actionhandler/wordtemplatehandler.1464164580.txt.gz · Last modified: 2021/07/01 09:54 (external edit)