Template Tutorials

A series of concise tutorials covering the main syntax features of Docmosis templates. These lessons guide you through mastering key template features for efficient template-based document generation.

A field is a placeholder within a template that controls the insertion or removal of content from the generated document. Creating fields A field is created just by typing. Fields begin with a "less-than less-than" and finish with a…
Comments can be used to mark content within a template that should be ignored and therefore won’t appear in the generated document. Comments are useful for: Embedding notes and explanations in a template. Disabling sections of templates temporarily to…
An optional paragraph field is just like a normal field, except, if there is no data for that field, the entire paragraph containing the field is removed. Field prefixes Docmosis provides a shorthand way of changing the behaviour of…
Creating high-quality templates is essential for generating well-structured documents. This tutorial explores the use of tables, paragraph properties and other template editor features to ensure that, as content is added or moved, the template always works in a predictable…
Conditional sections are similar to an "IF" statement. They are created using the <<cs_ prefix, and are used to mark content that should be included or removed from the generated document. If you use a conditional section within a…
Conditional Sections covered how to add or remove content from the final document. When a conditional section returns false and content is removed, there is sometimes a blank line left behind. Blank lines can be controlled by changing the…
Within a Conditional Section it is possible to include an Else statement to allow alternative content to be provided in case where an expression is false. Else-If style statements provide an alternative expression to be evaluated to conditionally include…
This example introduces the notation used to perform simple logic calculations in the templates. It explores how to call logic and boolean operators such as AND/OR within the template, which is most useful in Conditional Sections. It is best…
This example introduces the notation used to perform simple math calculations in the templates. It explains how to call math functions and format the results that are displayed in the generated document. It is best to view the template…
Depending on the particular software application you are using, it might not be possible to change your data before sending it to Docmosis. Docmosis has a range of string functions you can use within the templates to modify and…
Repeating data, from an array of data, can be displayed in many ways. This example contains: each item on a new line, each item on the same line, bullet lists, and numbered lists. Defining a repeating section A repeating…
This example demonstrates the use of the Docmosis size()function, and the built-in $size variable. Using array size When working with groups or sets of data, it may be necessary to display the total number of items in that group,…
Items in an array can be displayed as a comma separated string in a sentence. The examples below describe methods used to cater for the different possibilities of one, two, or more than two items in such a list,…
Docmosis allows you to control how numbers are displayed in the finished document. For example: the raw data may have numbers like: 1234.5. Using the built-in function numFormat the number can be formatted so that it looks like this: …
Docmosis allows you to control how dates and times are displayed in the finished document. For example: the raw data may have a date like: 21-03-16. Using the built-in function dateFormat the date can be formatted so that it…
This example shows you how to use tables to display repeating data (eg: objects in an array). By setting different table properties and paragraph properties you can control how the table lays out on the page when it is…
If a total is not provided as part of the data, it is possible to calculate a subtotal or a total from the data and display the result in the finished document. These examples make use of tables built…
Use the conditional rows <<cr_ directive in a template to include or exclude single or multiple rows from a table. You can filter out multiple rows based on conditions in the supplied data. Defining conditional rows In a table…
There may be times when you want to include or exclude columns in a table depending on the supplied data. Docmosis allows tables to conditionally add or remove a column through the use of conditional fields and expressions, allowing…
The Conditional Columns article covered how to include or exclude columns in a table using Boolean fields and expressions. However, sometimes a column may need to be excluded from a table when there is no data to display anywhere…
Tables with alternating row colors. The header row color is fixed. The color of the first two data rows determine if alternating colours should be used and what the alternating pattern colors are. Row coloring The first row in…
Dynamically inserting an image in to a document requires two things: The template controls where the image will appear The data determines what image is used This article explains how to use a placeholder image in the template. The…
Docmosis can generate and insert barcodes into documents. Docmosis supports Code 39, Code 128 and ITF 14 formats. Inserting barcodes Inserting barcodes with Docmosis uses a technique similar to inserting images. To insert a barcode, start by inserting a…
Docmosis can add hyperlinks and mailto links to documents, where the URL can be static or dynamic. With a static hyperlink the URL is known in advance. For a dynamic hyperlink, the URL is provided by the data at…
It’s possible to modify the “looping” features in Docmosis so that the data can be looped through in small groups or steps. The stepping feature can be used with the <<rs_ repeating sections or <<rr_ repeating rows directives. By…
The Stepping - Data example showed how data could be arranged into steps or groups of size “N” through the “:stepN” and “:stepNdown” directives – the “N” referring to the number of columns of data to be shown. When…
Templates can be combined into one resulting document, allowing content that appears in multiple documents to be separated out into a "shared" or common template. NOTE: This example relies on multiple template files, which can be found in the…
See how to combine different page sizes and orientations in a template. These can also be custom page sizes, used for mailing labels, tickets, packaging details, and so on. Docmosis uses the template's page setups, when generating a document. Microsoft…
Docmosis can help prepare a document for signing using signature services such as Adobe Sign. This example demonstrates how to add a signature field into a template. Adding Adobe Sign Text Tags to a template The required Adobe fields…
Docmosis can help prepare a document for signing using signature services such as signNow. This example demonstrates how to add a signNow signature tag into a Docmosis template. Adding signNow signature tags to a template A signNow signature tag…