-
Notifications
You must be signed in to change notification settings - Fork 528
command set
zmworm edited this page Jun 8, 2026
·
52 revisions
Modify properties of a document element.
officecli set <file> <path> [--find <text>] [--replace <text>] --prop <key=value> [--prop ...]
Modifies one or more properties of the element at the specified path. Multiple properties can be set by repeating --prop. Reports which properties were applied and which were unsupported.
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
file |
FileInfo | Yes | - | Office document path |
path |
string | Yes | - | DOM path, selector (e.g. paragraph[style=Heading1], Sheet1!row[Salary>5000]), Excel-native path (Sheet1!A1), or selected for watch-preview selection. Bare unscoped selectors (no element or / prefix) are rejected for agent safety. |
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
--prop |
string (repeatable) | Yes (unless --find alone) |
- | Property in key=value format |
--find |
string | No | - | Case-insensitive text/value filter — promoted from the legacy --prop find=X form. Combining --find with --prop find=... is rejected as ambiguous. |
--replace |
string | No | - | Replacement text — promoted from --prop replace=X to a top-level flag. Use with --find. |
-
Word set - All settable elements in
.docx -
Excel set - All settable elements in
.xlsx -
PowerPoint set - All settable elements in
.pptx
- Property keys are case-insensitive.
- Boolean values:
true/1/yes(truthy),false/0/no/empty (falsy). - Color values: hex RGB without
#prefix (e.g.,FF0000). - Dimensions: EMU or with unit suffix (
cm,in,pt,px). -
Query-selector paths (all formats): Selectors target elements by attribute and now flow through the same engine as
query—set <doc> 'paragraph[style=Heading1]' --prop font=Arial,set <doc> 'Sheet1!row[Salary>5000]' --prop fill=FFFF00. Excel-native paths (Sheet1!A1) are accepted alongside the/Sheet1/A1form. Selector mutation throws on attribute predicates the handler doesn't support, rather than silently no-oping. -
Boolean
and/orin selectors:cell[value>5000 or value<100],cell[(type=Number or type=Date) and value>0].query,set, andremoveall share the same boolean engine across all three formats. Row-by-column-name filters likerow[Salary>5000]are supported in Excel; OR'd table-column predicates insiderow[...]fail loud (never silent). -
--find/--replaceflags: Top-level text/value filter and replacement. The legacy--prop find=X --prop replace=Yform still works but emits a stderr hint pointing at the new flags. On docx,set --find ... --replace ... --prop revision.author=...performs a tracked Find&Replace. -
Auto-create styles (Word): Setting properties on a non-existent
/styles/{StyleId}path automatically creates the style. -
Selected pseudo-path: When a
watchprocess is running,officecli set <file> selected --prop ...applies the property set to each currently-selected element. Click or rubber-band in the browser preview to select.
- Command Reference
- get - Inspect element before modifying
- add - Add new elements
Based on OfficeCLI v1.0.105