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.
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 many versions of Word (Windows only): Word 2007, Word 2010, Word 2013 and Word 2016 (including Office 365 Click-to-Run). Windows RT is not supported.
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 with the data (base64-encoded) or referred to using an URL.
Beware though: using images will have an impact on the performance of the generation proces. When possible use images that have already been uploaded to the templates-folder to avoid unnessecary network traffic (and the resulting latency).
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.
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.
Our web-based API uses widely accepted standards to ensure compatibility with all application platforms available.
Check out the API-documentation for a technical specification of the API, including sample-code.