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 filled with data.
1) Simple Tables
Filling a simple Table with data.
The first row marked <<rr_ marks the start of a set of repeating rows. The placeholder word used after the rr_ identifies the top level array that holds the repeating data.
Docmosis will loop over the items in the array. The first block of data will be injected in to the rows that follow until a <<er_ marker is found. Then the second block of data is injected - and so on - until all the data has been used.
The <<rr_ and <<er_ rows do not appear in the output file.
2) Table and Paragraph Properties
By setting different Table and Paragraph Properties you can control how the table will display once it is filled with data.
When a table is filled with data it may expand and run over the page. You should select properties to control the behavior you desire.
Consider the following questions:
- Should the table be allowed to break across a page?
- Should the whole table move to the top of the next page?
- Should the first row appear be used as a Header Row if the table runs over the page?
- Does it make sense for some rows to always appear together?
You can control all of these options with Docmosis.
3) Row Numbering
Docmosis contains built-in variables to allow you to access/display the "number" of the data item that is currently being iterated. The Rowidx starts from 0. Rownum starts from 1.