Tables
The table model is similar to that of HTML. You combine cells into rows which form a table to be typeset. In HTML for example you can create a simple table with this code:
<table>
<tr>
<td>Hello,</td>
<td>world</td>
</tr>
<tr>
<td>Hello,</td>
<td>user</td>
</tr>
</table>
So a table is built row by row. In boxes and glue, the table consists of table rows (TableRow) and cells (TableCell). The contents of each cell is a sequence of Paragraph structs and the contents of a row is a sequence of cells.
Table cell
type TableCell struct {
BorderTopWidth bag.ScaledPoint
BorderBottomWidth bag.ScaledPoint
BorderLeftWidth bag.ScaledPoint
BorderRightWidth bag.ScaledPoint
BorderTopColor *color.Color
BorderBottomColor *color.Color
BorderLeftColor *color.Color
BorderRightColor *color.Color
CalculatedWidth bag.ScaledPoint
CalculatedHeight bag.ScaledPoint
HAlign HorizontalAlignment
VAlign VerticalAlignment
Contents []any
ExtraColspan int
ExtraRowspan int
PaddingTop bag.ScaledPoint
PaddingBottom bag.ScaledPoint
PaddingLeft bag.ScaledPoint
PaddingRight bag.ScaledPoint
}
Table row
type TableRow struct {
Cells []*TableCell
CalculatedHeight bag.ScaledPoint
VAlign VerticalAlignment
}
type Table struct {
MaxWidth bag.ScaledPoint
Stretch bool
FontFamily *FontFamily
FontSize bag.ScaledPoint
Leading bag.ScaledPoint
Rows TableRows
ColSpec []ColSpec
}
func (fe *Document) BuildTable(tbl *Table) ([]*node.VList, error)