-
Notifications
You must be signed in to change notification settings - Fork 517
word table set
zmworm edited this page Apr 29, 2026
·
52 revisions
Modify table, row, and cell properties.
Path: /body/tbl[N]
| Property | Accepted Values | Description |
|---|---|---|
style |
style ID | Table style |
alignment |
left, center, right
|
Alignment |
width |
twips or percentage | Width |
indent |
twips | Indent |
cellSpacing |
twips | Cell spacing |
layout |
fixed, auto
|
Layout mode |
padding |
twips | Default cell padding |
border.* |
border format | Borders (.all, .top, .bottom, .left, .right, .insideH, .insideV) |
officecli set report.docx /body/tbl[1] --prop alignment=center --prop width=100%
officecli set report.docx /body/tbl[1] --prop "border.all=single;4;000000;0"Path: /body/tbl[N]/tr[M]
| Property | Accepted Values | Description |
|---|---|---|
height |
twips | Height (at-least) |
height.exact |
twips | Height (exact) |
header |
bool | Repeat as header |
c1, c2, c3, ... |
text | Set text of cell by 1-based index |
officecli set report.docx /body/tbl[1]/tr[1] --prop header=true --prop height=400
# Set cell text using c1/c2/c3 shorthand
officecli set report.docx /body/tbl[1]/tr[1] --prop c1="Name" --prop c2="Value"Path: /body/tbl[N]/tr[M]/tc[K]
| Property | Accepted Values | Description |
|---|---|---|
text |
text | Cell text |
font, size, bold, italic, color
|
various | Formatting (all runs) |
shd/shading
|
shading format | Cell background |
alignment |
left, center, right, justify
|
Horizontal alignment |
valign |
top, center, bottom
|
Vertical alignment |
width |
twips | Cell width |
vmerge |
restart, continue
|
Vertical merge |
gridSpan/colspan
|
integer | Columns spanned |
padding, padding.top/bottom/left/right
|
twips | Margins |
textDirection/textDir
|
btlr/vertical, tbrl/vertical-rl, lrtb/horizontal
|
Text direction |
nowrap |
bool | No wrap |
border.* |
border format | Cell borders (.all, .top, .bottom, .left, .right) |
border.tl2br |
border format | Diagonal border top-left to bottom-right |
border.tr2bl |
border format | Diagonal border top-right to bottom-left |
Cell shading supports gradient format: shd=gradient;FF0000;0000FF;90 (type;color1;color2;angle)
# Style a header cell
officecli set report.docx /body/tbl[1]/tr[1]/tc[1] --prop text="Header" --prop bold=true --prop shd=4472C4 --prop color=FFFFFF --prop alignment=center
# Merge cells vertically
officecli set report.docx /body/tbl[1]/tr[1]/tc[1] --prop vmerge=restart
officecli set report.docx /body/tbl[1]/tr[2]/tc[1] --prop vmerge=continue
# Gradient cell shading
officecli set report.docx /body/tbl[1]/tr[1]/tc[1] --prop "shd=gradient;FF0000;0000FF;90"
# Diagonal cell borders
officecli set report.docx /body/tbl[1]/tr[1]/tc[1] --prop "border.tl2br=single;4;000000;0"
# Add image inside a table cell
officecli add report.docx /body/tbl[1]/tr[1]/tc[1] --type image --prop src=photo.jpgBased on OfficeCLI v1.0.64