VegaRise.NET

Table Style

TableStyle controls the layout algorithm, table look (header/footer, banding), width, indent, per-column widths, and cell spacing. Cell-level styling is done with TableCellStyle.

Band Table with Header

Use case: Produce a professional-looking table with a header and alternate row shading.

C#
1var tableStyle = new TableStyle
2{
3 Layout = TableLayoutValues.Autofit,
4 TableLook = new TableLook
5 {
6 FirstRow = true,
7 NoHorizontalBand = false,
8 },
9Width = new DocumentUnit(6.0, Units.inch),
10TableGridColsWidth = new List<DocumentUnit>
11{
12 new DocumentUnit(3.0, Units.inch),
13 new DocumentUnit(3.0, Units.inch),
14},
15};
16
17var table = new Table(3, 2);
18table.Style = tableStyle;

Fixed Column Widths

Use case: Use fixed layout so column widths never change.

C#
1var tableStyle = new TableStyle
2{
3 Layout = TableLayoutValues.Fixed,
4 TableGridColsWidth = new List<DocumentUnit>
5 {
6 new DocumentUnit(100, Units.pt),
7 new DocumentUnit(200, Units.pt),
8 new DocumentUnit(100, Units.pt),
9 }
10};

Cell Alignment

Use case: Center-align a header cell and right-align a numeric cell.

C#
1var header = new TableCellStyle
2{
3 VerticalAlignment = TableVerticalAlignmentValues.Center,
4 Justification = TableJustificationValues.center,
5};
6
7var numeric = new TableCellStyle
8{
9 Justification = TableJustificationValues.right,
10};
11
12table[0, 0].Style = header;
13table[1, 1].Style = numeric;

Frequently asked questions

How do I make a header row repeat on every page?

Mark the header row's TableRowStyle.RepeatOnEveryPage = true.

How do I apply the same border to all cells?

Set TableStyle.Borders using a TableBorder (which shares edges and inner borders).

VegaRiseVDocs.NET

Reset Password

Enter your email and we'll send you a link to reset your password.

Remember your password? Sign in