Versions Compared

Key

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

...

This actionhandler allows you to create and use Word document templates with values from process variables that usually come from a smartformform. The parameter "overwriteExisting" specifies whether existing templates may be overwritten (true) or whether a new template should be created. Variables from VariablesHelper can also be used with this actionhandler.

...

Info

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

...

Firstly, a Word document is used as a template. The template includes two variables (${employee_name}, ${employee_id}). These variables are used in the smartform Form later. To ensure that the variables are replaced with the content from the Smartform Form by the WordTemplateHandler, the variables must be placed inside a ‘Text Form Field’ in Word.

...

The Word document is saved with the name ${employee_name}.docx. The ActionHandler replaces the variable in the document name with the employee's name provided in the SmartformForm.

This template should be uploaded to the ‘Resources’ in the Administration:

...

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 smartformform. The document is stored in the “Documents” tab of the process instance.

${employee_name}.docx

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

...

Once the process with its Smartform form is published, start a process instance and enter the employee’s name and ID, when starting it.

...

The variables in the document as well as in the document name were replaced with the values from the smartformform.

...

...

Integrating the WordTemplateHandler into a HTML-

...

Form

The WordTemplateHandler can be integrated into a HTML-Smartform Form as a link, a button, or an image so that the participants can create a template at any time. For this, the following code must be integrated into the smartformform:

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

...

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).

...

Important when using HTML-

...

Forms

Normally written text will be inherited, whereas variables will be overwritten if marked as ${Variable-ID}. To overwrite variables with content from the HTML form, you must use the variable's ID, such as ${Variable-ID}, within the text form fields. An exception to this rule applies to radio buttons, where you should use the variable name, like ${Variable-Name}, instead of the variable ID.

...