Document Templates

Last modified: June 25, 2025

Introduction

Document Templates are used to model a template required as input for a document export action which can generate all kinds of documents based on application data. They are composed much in the same way as Pages. However, document templates were deprecated in 10.24. If you wish to use non-deprecated solutions, see the Alternatives section below.

The document templates also contain components, also know as widgets. Below is a categorized overview of all widgets. The following categories are used:

  • Core widgets are central to building document templates in Mendix. These are the widgets that can show a list of entities or a single entity
  • Layout widgets are used to structure the layout of your document templates
  • Dynamic data widgets make it possible to show values of attributes and associations
  • Static data widgets allow you to work with static data such as a predefined image

Additionally, in most widgets as well as on the document template itself, a style can be defined. For more information, see Style.

If you would like to display text in a language with uncommon characters such as Arabic or Thai, make sure you select a font in the style editor that supports these characters. “Tahoma” is such a font.

Core Widgets

The core widgets are central to building document templates in Mendix. They can show the contents of a single entity or of a list of entities. Every document template designed to show data from the domain model requires one of these components.

Data Grid

The data grid shows a list of objects in a grid. For example, a data grid can show all the orders a customer has placed.

For more information, see Data Grid (Document Template).

Data View

The data view is used for showing the contents of exactly one object. If, for example, you want to show details of a single customer you would use a data view to do this. The data view typically contains a table with static labels and dynamic data widgets like a dynamic label. In more complex templates, a data view can contain data grids and other data views for related objects.

For more information, see Data View (Document Template).

Template Grid

The template grid shows a list of objects in a tile view. For example, a template grid can show a list of products. The template grid has a lot in common with the data grid. The main difference is that the objects are shown in templates (somewhat like a small data view) instead of rows.

For more information, see Template Grid (Document Template).

Layout Widgets

Layout widgets give structure to a page. They do not show data but provide a layout in which you can place other widgets that do.

Table

Tables can be used to change the layout of the page. They contain a number of rows and columns and the intersection of the two is called a cell. Each cell can contain widgets. Cells can be merged horizontally and vertically before they are filled to allow for asymmetric layouts. Tables can be used both inside and outside data view or templategrid widgets.

For more information, see Table (Document Template).

Page Break

When inserting a page break, the current page will be cut off after the break and widgets below the break will be displayed in a new page.

For more information, see Page Break (Document Template).

Line Break

When inserting a line break, a new line will be inserted at that position.

For more information, see Line Break (Document Template).

Dynamic Data Widgets

Dynamic data widgets are used for showing (dynamic) data. They must be placed inside a data view or template grid because they show attributes or associations of an entity.

Dynamic Label

A dynamic label is used for the same attribute types as a text box in the page editor. It can be used to display a text value.

For more information, see Dynamic Label (Document Template).

Dynamic Image

A dynamic image can be used to show a System.Image. If the image is not available (for example: the image was never saved) it will show the preset default image. It can be deployed inside a data view or templategrid.

For more information, see Dynamic Image (Document Template).

Static Data Widgets

These widgets contain static (fixed) data to help create the look of the generated document.

Static Label

A static label shows a line of static text. You can use it to place custom text inside a dataview or template grid or table.

For more information, see Static Label (Document Template).

Title

A title works much like a static label but can be placed outside a data view, template grid or table.

For more information, see Title (Document Template).

Static Image

A static image shows a predefined image. It can be put either in- or outside a data view or templategrid.

For more information, see Static Image (Document Template).

Alternatives

Document Templates in Mendix allowed the generation of various document types. This section explains the appropriate replacement options for each previously supported document type.

PDF

To generate PDF documents, use the PDF Document Generation capability, which allows you to define PDFs based on standard Mendix pages. This approach offers significantly greater flexibility and control over the layout and design of your PDF documents compared to the deprecated Document Templates.

HTML

To generate HTML documents, create the HTML manually and use the token replacement capabilities of the Mx Model Reflection module to insert application data. Open source tools such as MJML can assist in designing visually appealing HTML, especially for email templates.

Microsoft Word

Generating Microsoft Word documents is no longer supported by Mendix. However, there are several alternative solutions available — both free and paid — maintained by Mendix partners and the community that support Word document generation. These can be found in the Mendix Marketplace.

Other Formats

Other formats, including Rich Text Format (.rtf) and OpenDocument Text (.odt), are no longer supported by Mendix and do not have official alternatives. We understand this may impact certain use cases, and we recommend exploring whether supported formats like PDF or HTML can meet your current needs.