How it works
Template-based document generation means that the target document is not created from scratch, but a template is used as a starting point.
The template specifies the design of the document and contains special placeholders that indicate where data much be placed.
The generation proces loads the template and merges the data, which results in the final document. Optionally the generated document can be password-protected (encrypted).
Because the template is our starting point, the document can be completely designed using just Word. No need for programming against a complex API's.
No compromises, just beautiful documents!
Templates are basically just regular Word-documents. Therefore they can be created by using the most popular document processor around: Microsoft Word ®!
The Docati Word-AddIn is an add-in/plug-in for Microsoft Word®. It adds a special ribbon (toolbar) which grants access to all Docati-functionality a template designer needs:
* The add-in supports all versions of Word (Windows only, Windows RT excluded), including Office 365 Click-to-Run.
Inside the text of the template, special placeholders must be placed, to let the Docati Document Generator know where to insert the data.
The Docati Word Add-In is required to insert these placeholders. This is an example of a template containing placeholders:
Available placeholders are:
ValueOf: inserts data
Does what document generation is all about: insert data. By default data is inserted as-is (text). However it’s also possible to specify formatting options, which allows for formatting as a number with a certain amount of digits, a date/time and even allows you to provide a custom formatting string.
ForEach: repeats its contents for each data-item
A very powerfull placeholder which allows for creating tables, but also bullet-lists, chapters, etc.
ImageOf: insert an image
Just like ValueOf this placeholder inserts content into the document. Instead of just text, this placeholder inserts an image. The image can be provided within the data (base64-encoded) or referred to using an URL.
NEW: BarcodeOf: insert a barcode (EAN or QR)
This placeholder generated an EAN- or QR-barcode and inserts it into the document.
If: only renders its content if the condition evaluates to true
Allows for conditional parts of the document, eg: a specific chapter only appears if the data contains a specific element.
UseContext: specifies the data-context
For more experienced users (with xpath-knowledge): when processing its contents, the data-context is set in advance. This allows for shorter/easier data-queries for its child placeholders, thus resulting in better maintainability of the template.
ImportTemplate: imports a (sub)-template
A powerfull placeholder that allows you to create templates templates that you can reuse (like sub-templates), for example: a standard header template, a address-block template, etc. Templates can be imported in the main document, header and footer. The ImportTemplate-placeholder can also be used inside a ForEach- or If-placeholder.
Data can be supplied as either XML or Json. Placeholders must specify a query to refer to specific parts of the data. Queries can be specified in two formats:
- Regular: only the name of an item in the XML must be specified. Casing and namespaces don’t matter. Anybody can work with these queries!
- Advanced: these are XPath-expressions. XPath is a complex but powerful XML query-language. Usually requires software developers to work with these.
In most cases, regular queries will do the job. For example, take this data-XML:
Say you need the name of the examinee. Using a regular query you would simply specify Name and Docati will find it.
Check the documentation for more information on queries.