-
Notifications
You must be signed in to change notification settings - Fork 930
word table
Tables in Word documents with rows and cells, supporting styles, borders, merging, and cell-level formatting.
Path: /body/tbl[N], /body/tbl[N]/tr[M], /body/tbl[N]/tr[M]/tc[K]
Note:
cantSplit,nowrap, andhideMarkare row/cell-scoped (matching where OOXML stores them) — passing them toadd --type tableis rejected as UNSUPPORTED. Set them on the row (cantSplit) or cell (nowrap,hideMark) instead — see Table Add / Table Set.
-
get - Returned attributes and output format
-
add - Add tables, rows, and cells
-
set - Modify table, row, and cell properties
officecli get report.docx /body/tbl[1]
officecli get report.docx /body/tbl[1] --depth 3
officecli get report.docx /body/tbl[1]/tr[1]/tc[1]officecli query report.docx "table"officecli remove report.docx /body/tbl[1]
officecli remove report.docx /body/tbl[1]/tr[3]Word's OOXML has no <w:col> child of <w:tbl> — columns are implicit (<w:gridCol> in <w:tblGrid> plus per-row <w:tc>). v1.0.97 synthesizes a virtual column axis with full add / remove / move / --from (copy-from) parity:
# Insert a column at position 2 (shifts existing col 2 onward) — parent is the table, --type column required
officecli add report.docx /body/tbl[1] --type column --index 2 --prop width=2cm
# Seed text into every new cell of the column
officecli add report.docx /body/tbl[1] --type column --prop text=Header
# Clone column 1's cells (text + style) into a new column
officecli add report.docx /body/tbl[1] --type column --index 3 --from /body/tbl[1]/col[1]
# Remove a column
officecli remove report.docx /body/tbl[1]/col[2]
# Move a column (same-table only)
officecli move report.docx /body/tbl[1]/col[3] --to /body/tbl[1] --index 1Get/Set/Query at the column level are not implemented — read width via /body/tbl[1] tblGrid or per-cell tcW. Insert is rejected when the column slot crosses a merged cell (gridSpan/vMerge) — unmerge first.
Cells accept hMerge for horizontal merge (parity with vertical vMerge). Cell-level hMerge=continue marks continuation cells; hMerge=restart (or omission) is the leading cell.
Based on OfficeCLI v1.0.131