Document Templates

Last update: Edit

1 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.

Document templates may contain components, also known as widgets. Below is an overview of all widget categories:

  • 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.

2 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.

2.1 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).

2.2 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).

2.3 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).

3 Layout Widgets

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

3.1 Table

Tables can be used to change the layout of the form. 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).

3.2 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).

3.3 Line Break

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

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

4 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.

4.1 Dynamic Label

A dynamic label would be used for the same attributetypes as a text box in form builder. It can be used to display a text value.

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

4.2 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).

5 Static Data Widgets

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

5.1 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).

5.2 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).

5.3 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).