Repository navigation
word table add
goworm edited this page Jul 8, 2026
·
55 revisions
Add tables, rows, and cells to the document.
Parent: /body
| Property | Default | Description |
|---|---|---|
rows |
1 |
Number of rows |
cols |
1 |
Number of columns |
data |
- | Table data: inline (H1,H2;R1C1,R1C2) or CSV source (local path, HTTP URL, or data: URI) |
colWidths |
auto | Comma-separated widths (twips) |
alignment |
- |
left, center, right
|
width |
- | Width (twips or percentage, e.g. 100%) |
layout |
- |
fixed, auto
|
style |
- | Table style (e.g. TableGrid, with TableLook for banding) |
border.all |
single |
Default borders |
border.top, border.bottom, border.left, border.right
|
- | Individual borders |
border.insideH, border.insideV
|
- | Inside borders |
indent, cellSpacing, padding
|
- | Spacing |
caption |
- | Accessibility caption for the table (<w:tblCaption>). Surfaced to assistive technology |
rowBandSize |
1 |
Rows per band when a banded table style applies (<w:tblStyleRowBandSize>); e.g. 2 stripes every second row |
colBandSize |
1 |
Columns per band when a banded table style applies (<w:tblStyleColBandSize>). Alias: columnBandSize
|
tblLook |
04A0 |
Conditional-formatting bitmask (4-digit hex) selecting which facets of a conditional/banded style apply (0x0020 firstRow, 0x0040 lastRow, 0x0080 firstColumn, 0x0100 lastColumn, 0x0200 noHBand, 0x0400 noVBand). Decomposed facets also settable as tblLook.firstRow etc. |
# Add a 3x4 table
officecli add report.docx /body --type table --prop rows=3 --prop cols=4
# Add styled table
officecli add report.docx /body --type table --prop rows=5 --prop cols=3 --prop style=TableGrid --prop alignment=center
# Add table from inline data (semicolons separate rows, commas separate cells)
officecli add report.docx /body --type table --prop "data=Name,Score;Alice,95;Bob,88"
# Add table from CSV file
officecli add report.docx /body --type table --prop data=/tmp/scores.csv
# Add table from CSV URL
officecli add report.docx /body --type table --prop data=https://example.com/data.csvParent: /body/tbl[N]
| Property | Default | Description |
|---|---|---|
cols |
from grid | Cell count |
height |
- | Row height (twips or with unit: 1.5cm, 0.5in, 36pt) |
height.exact |
- | Exact row height (twips or with unit) |
header |
- | Repeat row as header |
cantSplit |
- |
w:cantSplit — keep the row on one page (no break across pages). Row-scoped: apply per row, not on the table. |
c1, c2, c3, ... |
(empty) | Cell text by position |
officecli add report.docx /body/tbl[1] --type row --prop c1="Name" --prop c2="Value" --prop c3="Total"Cells are created automatically when adding rows. To add content within a cell, add paragraphs or runs to the cell path.
officecli add report.docx /body/tbl[1]/tr[1]/tc[1] --type paragraph --prop text="Cell content"Based on OfficeCLI v1.0.131