-
Notifications
You must be signed in to change notification settings - Fork 903
word shape
goworm edited this page Jul 6, 2026
·
2 revisions
DrawingML shape (w:drawing → bare wps:wsp with a:prstGeom). Visual primitive without a text body — for arrows, callouts, banners, decorative geometry.
Path: /body/shape[N]
-
add,set,get,remove -
Get returns raw XML preview only — no structured
Formatreadback of any property below. Useget --depth Nto inspect the raw XML, orrawfor the full part.
| Property | Description |
|---|---|
geometry / preset
|
Shape preset (rect, roundRect, ellipse, triangle, diamond, …) |
width / height
|
Size (cm/in/pt/EMU). Default ~1in × ~1in. |
fill |
Solid fill color (hex/name), or none
|
line |
Composite outline "STYLE;SIZE;COLOR" (or none); split keys below also accepted |
line.color / linecolor
|
Outline color |
line.width / linewidth
|
Outline width |
line.style / linestyle
|
Outline dash style — not line.dash
|
wrap |
Text-wrap mode of surrounding body text: square, tight, through, topAndBottom, behind, front, none
|
hAlign / halign
|
Relative horizontal alignment: left, center, right, inside, outside. Ignored if anchor.x is also set. |
vAlign / valign
|
Relative vertical alignment: top, center, bottom, inside, outside. Ignored if anchor.y is also set. |
hRelative / hrelative
|
What horizontal position is measured from: margin, page, column, character, leftMargin, rightMargin, insideMargin, outsideMargin
|
vRelative / vrelative
|
What vertical position is measured from: margin, page, paragraph, line, topMargin, bottomMargin, insideMargin, outsideMargin
|
anchor.x / hposition
|
Horizontal position offset from the hRelative origin |
anchor.y / vposition
|
Vertical position offset from the vRelative origin |
alt / name
|
Accessibility / object name (docPr name). Default Shape. |
No x/y shorthand and no rotation — docx shape does not accept either (unlike pptx shape, which has both). Position is anchor.x/anchor.y or hAlign/vAlign.
Only geometry/fill/line are settable on an existing shape — position, alignment, wrap, and alt text are add-only:
| Property | Description |
|---|---|
geometry / preset
|
Shape preset |
width / height
|
Size |
fill |
Solid fill color, or none
|
line / line.color / line.width / line.style
|
Outline |
officecli add report.docx /body --type shape --prop geometry=rightArrow --prop width=4cm --prop height=2cm --prop fill=4472C4
officecli set report.docx /body/shape[1] --prop fill=ED7D31 --prop line.style=dash-
Word: Textbox — same family, with
wps:txbxbody - Word Reference
Based on OfficeCLI v1.0.129