Table

You can build custom tables using the Table type.

Argument 1: cells

The table's content is given as an AbstractMatrix of Cells:

using SummaryTables

cells = [Cell("$col$row") for row in 1:5, col in 'A':'E']
Table(cells)
A1 B1 C1 D1 E1
A2 B2 C2 D2 E2
A3 B3 C3 D3 E3
A4 B4 C4 D4 E4
A5 B5 C5 D5 E5

Keyword: header

You can pass an Int to mark the last row of the header section. A divider line is placed after this row.

using SummaryTables

cells = [Cell("$col$row") for row in 1:5, col in 'A':'E']
Table(cells; header = 1)
A1 B1 C1 D1 E1
A2 B2 C2 D2 E2
A3 B3 C3 D3 E3
A4 B4 C4 D4 E4
A5 B5 C5 D5 E5

You can pass an Int to mark the first row of the footer section. A divider line is placed before this row.

using SummaryTables

cells = [Cell("$col$row") for row in 1:5, col in 'A':'E']
Table(cells; footer = 5)
A1 B1 C1 D1 E1
A2 B2 C2 D2 E2
A3 B3 C3 D3 E3
A4 B4 C4 D4 E4
A5 B5 C5 D5 E5

Keyword: footnotes

The footnotes keyword allows to add custom footnotes to the table which do not correspond to specific Annotated values in the table.

using SummaryTables

cells = [Cell("$col$row") for row in 1:5, col in 'A':'E']
Table(cells; footnotes = ["Custom footnote 1", "Custom footnote 2"])
A1 B1 C1 D1 E1
A2 B2 C2 D2 E2
A3 B3 C3 D3 E3
A4 B4 C4 D4 E4
A5 B5 C5 D5 E5
Custom footnote 1    Custom footnote 2

Keyword: rowgaps

It can be beneficial for the readability of larger tables to add gaps between certain rows. These gaps can be passed as a Vector of Pairs where the first element is the index of the row gap and the second element is the gap size in pt.

using SummaryTables

cells = [Cell("$col$row") for row in 1:9, col in 'A':'E']
Table(cells; rowgaps = [3 => 8.0, 6 => 8.0])
A1 B1 C1 D1 E1
A2 B2 C2 D2 E2
A3 B3 C3 D3 E3
A4 B4 C4 D4 E4
A5 B5 C5 D5 E5
A6 B6 C6 D6 E6
A7 B7 C7 D7 E7
A8 B8 C8 D8 E8
A9 B9 C9 D9 E9

Keyword: colgaps

It can be beneficial for the readability of larger tables to add gaps between certain columns. These gaps can be passed as a Vector of Pairs where the first element is the index of the column gap and the second element is the gap size in pt.

using SummaryTables

cells = [Cell("$col$row") for row in 1:5, col in 'A':'I']
Table(cells; colgaps = [3 => 8.0, 6 => 8.0])
A1 B1 C1 D1 E1 F1 G1 H1 I1
A2 B2 C2 D2 E2 F2 G2 H2 I2
A3 B3 C3 D3 E3 F3 G3 H3 I3
A4 B4 C4 D4 E4 F4 G4 H4 I4
A5 B5 C5 D5 E5 F5 G5 H5 I5

Types of cell values

TODO: List the different options here