Tables
Create data tables with cell-level formatting.
Basic Table
typescript
slide.addTable([
[{ text: 'Name' }, { text: 'Score' }],
[{ text: 'Alice' }, { text: '95' }],
[{ text: 'Bob' }, { text: '87' }],
], { x: 1, y: 1, w: 6, h: 3 });Styled Headers
typescript
slide.addTable([
[
{ text: 'Feature', options: { bold: true, fill: '4472C4', color: 'FFFFFF' } },
{ text: 'Status', options: { bold: true, fill: '4472C4', color: 'FFFFFF' } },
],
[{ text: 'Text' }, { text: 'Done' }],
[{ text: 'Charts' }, { text: 'Done' }],
], { x: 1, y: 1, w: 8, h: 4, border: { color: 'CCCCCC', width: 1 } });Cell Merging
Use colSpan and rowSpan to merge cells:
typescript
slide.addTable([
[
{ text: 'Merged Header', options: { colSpan: 3, bold: true, fill: '003366', color: 'FFFFFF', align: 'center' } },
{ text: '' },
{ text: '' },
],
[{ text: 'A' }, { text: 'B' }, { text: 'C' }],
], { x: 1, y: 1, w: 8, h: 2 });Per-Cell Borders
typescript
slide.addTable([
[{
text: 'Custom borders',
options: {
borderBottom: { color: 'FF0000', width: 2 },
borderRight: { color: '0000FF', width: 1 },
},
}],
], { x: 1, y: 1, w: 4, h: 1 });Banded Rows
typescript
slide.addTable(rows, {
x: 1, y: 1, w: 8, h: 5,
bandRow: true,
bandRowColors: ['F0F0F0', 'FFFFFF'],
firstRow: true,
});| Flag | Description |
|---|---|
firstRow | Apply special formatting to the first row |
lastRow | Apply special formatting to the last row |
firstCol | Apply special formatting to the first column |
lastCol | Apply special formatting to the last column |
bandRow | Alternate row shading |
bandCol | Alternate column shading |
Cell Options
Each cell can have:
| Option | Type | Description |
|---|---|---|
text | string | Cell content |
options.bold | boolean | Bold text |
options.italic | boolean | Italic text |
options.fontSize | number | Font size |
options.color | Color | Text color |
options.fill | Fill | Cell background |
options.align | string | Text alignment |
options.verticalAlign | string | 'top', 'middle', 'bottom', 'distributed' |
options.colSpan | number | Columns to span |
options.rowSpan | number | Rows to span |
options.margin | object | Cell padding { top, right, bottom, left } |
See TableCell for the full reference.
Table Options
| Option | Type | Description |
|---|---|---|
x, y | number | Position in inches |
w, h | number | Size in inches |
colWidths | number[] | Column widths in inches |
rowHeights | number[] | Row heights in inches |
border | TableBorderOptions | Table-wide border settings |
fill | Fill | Default cell background |
bandRow | boolean | Alternate row shading |
bandRowColors | [Color, Color] | Alternating row colors |
See TableOptions for the full reference.

