Filling tables with array data

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.

Filling a 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 into the rows that follow until an <<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.

Table and paragraph properties

When a table is filled with data it may expand and run over the page.

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?

By setting different table properties and paragraph properties you can control how the table will display once it is filled with data.

Row numbering

Docmosis contains two built-in variables, $rowidx and $rownum, that allow you to access/display the "number" of the data item that is currently being iterated.

  • $rowidx starts from 0
  • $rownum starts from 1

Feedback

Invalid Input

Sorry, this field will only accept letters and numbers, and not special characters, to limit spam. Please also consider contacting support@docmosis.com if you need help with this article.

Sorry, this field will only accept letters and numbers, and not special characters, to limit spam.

Invalid Input