Document templates are used to automatically create document versions, based on the filled document fields or business process variables.
You can use the following file types as a template: .rtf, .txt, .doc, .docx, .xls, .xlsx, .xml, .html.
Document template is a file, which includes the static and dynamic parts. Static part does not change, while the dynamic part contains variable names, whose values are generated from the document attributes or process context variables.
Template syntax
A document template can include text, names of document type attributes and of context variables. All the variables in the template look like that:
{$variable_name}
You can use any document attribute of process variables of any data type in a document template. Keep in mind, that all the variables, regardless of their data type, are converted into the String data type for correct display in the template.
Using blocks
{for Item in {$variable_name}}
{$Item.property1_name} {$Item.property2_name} {$Item.property3_name}
{end}
After the document is generated by this template, the block properties will be written one after another.
Using conditions
Condition starts with {if } and ends with {end}. You can use {end if} instead of {end}.
<condition> - any condition, e.g. {$variable_name}=true.
{else} - allows performing an action, if the condition is false.
Condition structure:
{if }
< Action, if the condition is true>
{else}
< Action, if the condition is false>
{end}
Display of date and time in a specified format
For the date and time to display correctly in a template, you must add a context variable of the Date/Time type. The syntax of this variable will look like this: {DateTimeFormat({$Date}; ‘dd –MM –yy , H:mm:ss’)}, where:
dd –MM –yy - data display format;
H:mm:ss – time display format.
Display of numbers in a specified format
For correct display of number in the required format, use the following syntax: {NumberFormat(2345.6789;2)}, where:
2345.6789 – number display format;
2 – number of decimal places.
Numbers are generated in a document without creating a context variable.
Display of money in a specified format
For correct display of money in a specified format, use the following syntax: {MoneyFormat(2345.6789;2)}, where:
2345.6789 – number display format;
2 – number of decimal places.
Numbers are generated in a document without creating a context variable.
Creating a template
To create document template, you have to:
-
create a document on the local PC or in ELMA;
-
add the document template text and the required context variables to the document;
You can upload a document template to the system from local PC or you can use an ELMA document.
Fig. 1 illustrates an example of a document template.
|
Fig. 1. Example of a document template
|
You can use a document template when:
-
-
executing a business process.
Using a template when creating a document
To be able to use a template for generating a document, when creating a document version, you have to:
-
Create a document template.
-
Add the created template to the document type. To do so, go to Administration - Document Management - Document Types, open the document type settings and select the Templates tab.
You can add several templates for each document type.
When creating/editing a document of this type, the Add Template button will be added to the Versions unit (fig. 2)..
|
Fig. 2. Document page. Add Template button
|
When you click on this button, you have to select the template for generating a document version (fig. 3).
|
Fig. 3. Selecting a document template
|
After that, the document version will be generated according to the selected template. Fig. 4 shows an example of a document version, generated from a template. The selected text is generated by using the document attributes.
|
Fig. 4. Document version, generated from a template
|
To save the registration variant, click Save.
Using a document template in a business process
Copyright © 2006–2019 ELMA