-
Notifications
You must be signed in to change notification settings - Fork 108
command raw
zmworm edited this page Mar 31, 2026
·
23 revisions
Low-level XML operations for viewing and modifying document internals.
officecli raw <file> [part] [--start N] [--end N] [--cols A,B,C]
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
file |
FileInfo | Yes | - | Office document path |
part |
string | No | /document |
Part path |
--start |
int | No | - | Start row (Excel only) |
--end |
int | No | - | End row (Excel only) |
--cols |
string | No | - | Column filter (Excel only) |
officecli raw-set <file> <part> --xpath <xpath> --action <action> [--xml <fragment>]
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
file |
FileInfo | Yes | - | Office document path |
part |
string | Yes | - | Part path |
--xpath |
string | Yes | - | XPath to target element(s) |
--action |
string | Yes | - | Action (see below) |
--xml |
string | No | - | XML fragment or name=value for setattr |
| Action | Description |
--xml Required |
|---|---|---|
append |
Add as last child | Yes |
prepend |
Add as first child | Yes |
insertBefore / before
|
Insert before element | Yes |
insertAfter / after
|
Insert after element | Yes |
replace |
Replace element | Yes |
remove / delete
|
Remove element | No |
setattr |
Set attribute (name=value) |
Yes |
officecli add-part <file> <parent> --type <type>
Creates a new part (chart, header, footer) and returns relId + partPath for use with raw-set.
- Word raw - Word parts, namespaces, and examples
- Excel raw - Excel parts, namespaces, and examples
- PowerPoint raw - PowerPoint parts, namespaces, and examples
- Unprefixed elements in
--xmlinherit the document's default namespace. - Validates before and after modification. New errors reported as warnings.
- Use
rawfirst to understand the XML structure before usingraw-set.
- Command Reference
- validate - Validate after raw modifications
- get - Inspect structure before modifying
Based on OfficeCLI v1.0.28