Skip to content

word table

zmworm edited this page May 24, 2026 · 52 revisions

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]

Operations

  • get - Returned attributes and output format

  • add - Add tables, rows, and cells

  • set - Modify table, row, and cell properties

get

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]

query

officecli query report.docx "table"

remove

officecli remove report.docx /body/tbl[1]
officecli remove report.docx /body/tbl[1]/tr[3]

Virtual column operations

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)
officecli add report.docx /body/tbl[1]/col --index 2

# Clone column 1's cells (text + style) into a new column
officecli add report.docx /body/tbl[1]/col --index 3 --from /body/tbl[1]/col[1]

# Remove a column
officecli remove report.docx /body/tbl[1]/col[2]

# Move a column
officecli move report.docx /body/tbl[1]/col[3] --to /body/tbl[1] --index 1

Horizontal merge

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.97

Clone this wiki locally