1. Home
  2. Docs
  3. Chapter 23. Document Production
  4. 5. Writing Doc. Composer element templates
  5. Working with Table

Working with Table

Download PDF

<TableBlock>

Insert a table to document. It is typically used to present table of elements or element properties. You must combine the use of <TableRow> and <TableCell> in order to form a complete table. Most of the build-in templates are formed by tables and contains <TableBlock>. You can look for references easily.

Name Description/Usage Required?
tableStyle : string Specify the table style by its ID. You can find the ID of table styles in the Formats window of Doc. Composer.
tableWidth : string The width of table. For example: ‘50%’ means to occupy 50% of page width. There are four available units:
% (e.g. 50%)
cm (e.g. 10cm)
mm (e.g. 800mm)
px (e.g. 500px)
Optional
colWidths : integers Specify the widths of table columns in ratio, separate by comma. Note that the number of columns specify in @colWidths must match the number of <TableCell> to add under <TableRow>, under this table.

For example, specify “1, 1, 2” for a table with 20000 as width will result in creating a table with three columns, and have widths 5000, 5000, 10000.

Optional
rowBackgroundColors : colors Background color of rows in table. Optional
repeatTableHeader
{true | false | followOption}
True to repeat the table header row at the top of the next page for table that span multiple pages. Note that this option only works in PDF and Word document.

If “followOption”, it will follow the setting set in Doc. Composer’s document export window.

Optional
singlePage : boolean = false True to ensure that a table will not be split in two or more pages. When the remaining space of a page cannot display the whole table, Doc. Composer will try to show it in the next page. If the table height is longer than a page, the exceeding part of the table will be cropped. Optional

<TableRow>

Enables you to add cells to a <TableRow>.

Name Description/Usage Required?
height : integer How tall it is for the table row. Optional
backgroundColor : color Background color of row. Optional
singlePage : boolean = false True to ensure that a table row will not be split in two or more pages. When the remaining space of a page cannot display the whole row, Doc. Composer will try to show it in the next page. Optional

<TableCell>

Enables you to add cells to a <TableRow>.

Name Description/Usage Required?
topBorderEnable : boolean = true True to draw the top border of cell. Optional
bottomBorderEnable : boolean = true True to draw the bottom border of cell. Optional
leftBorderEnable : boolean = true True to draw the left border of cell. Optional
rightBorderEnable : boolean = true True to draw the right border of cell. Optional
verticalAlignment

{top | center | bottom}

The vertical alignment of cell. Optional
color : color The background color of cell. Optional
colspan : integer Specify the number of cell this cell consumes horizontally. For example, a colspan of 2 means to consume this and the cell on the right. This is equivalent to HTML’s colspan. Optional