-
Notifications
You must be signed in to change notification settings - Fork 541
word reference
zmworm edited this page Mar 23, 2026
·
55 revisions
Complete reference for OfficeCLI operations on Word documents.
| Element | Path | Operations |
|---|---|---|
| Document | / |
set |
| Paragraph | /body/p[N] |
add, set |
| Run | /body/p[N]/r[M] |
add, set |
| Table | /body/tbl[N] |
add, set |
| Header/Footer |
/header[N], /footer[N]
|
add, set |
| Watermark | /watermark |
add, set |
| Section | /section[N] |
add, set |
| Picture | (inline/floating) | add |
| Bookmark | /bookmark[Name] |
add, set |
| Footnote/Endnote |
/footnote[N], /endnote[N]
|
add |
| Hyperlink | (inline) | add |
| Comment | (attached) | add |
| TOC | /toc[N] |
add |
| Equation | (inline/block) | add |
| Style | /styles/{StyleId} |
add, set |
| Chart | /chart[N] |
add, set |
| Field | (inline) | add |
| Break | (inline) | add |
| SDT/Content Control | /body/sdt[N] |
add, set, remove |
For low-level operations using the raw and raw-set commands:
| Part Path | Description |
|---|---|
/document (default) |
Main document body XML |
/styles |
Style definitions XML |
/numbering |
List/numbering definitions |
/settings |
Document settings |
/header[N] |
Header XML (0-based for raw) |
/footer[N] |
Footer XML (0-based for raw) |
XPath namespace prefixes: w (WordprocessingML), r (Relationships), a (DrawingML), mc (Markup Compatibility), wp (Word Drawing), wps (Word Drawing Shape), v (VML)
# View raw document XML
officecli raw report.docx /document
# Remove all bold from document
officecli raw-set report.docx /document --xpath "//w:b" --action remove
# Set justification via raw XML
officecli raw-set report.docx /document --xpath "//w:pPr/w:jc" --action setattr --xml "w:val=center"# Copy a paragraph
officecli add report.docx /body --from /body/p[1]
# Copy a table
officecli add report.docx /body --from /body/tbl[1] --index 0Based on OfficeCLI v1.0.18