-
Notifications
You must be signed in to change notification settings - Fork 518
word table add
zmworm edited this page Apr 29, 2026
·
52 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 |
# 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 |
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.64