Skip to content

word paragraph set

zmworm edited this page May 1, 2026 · 52 revisions

Word: Paragraph - set

Modify paragraph formatting, style, indentation, spacing, and borders.

Path: /body/p[N]

Properties

Property Accepted Values Description
style style ID Paragraph style
align / alignment left, center, right, justify Text alignment. Get returns canonical align; alignment accepted as input alias for backward compat.
text text Set text of first run (or create run)
font font name Apply font to all runs
size number (pt) Apply size to all runs
bold bool Apply bold to all runs
italic bool Apply italic to all runs
color hex color Apply color to all runs
underline underline style Apply underline to all runs
strike/strikethrough bool Apply strikethrough to all runs
highlight highlight color Apply highlight to all runs
vertAlign superscript/super, subscript/sub, baseline Vertical alignment on runs
smallCaps bool Small capitals
firstLineIndent twips or unit-qualified First line indent. Accepts bare twips (OOXML native) or unit-qualified strings: 2cm, 0.5in, 18pt. Max 31680 twips (22 inches).
leftIndent/indentLeft/indent integer (twips) Left indent
rightIndent/indentRight integer (twips) Right indent
hangingIndent/hanging integer (twips) Hanging indent
spaceBefore integer Space before
spaceAfter integer Space after
lineSpacing integer Line spacing
keepNext bool Keep with next
keepLines/keepTogether bool Keep together
pageBreakBefore bool Page break before
break newPage/page Alias mapping to pageBreakBefore=true
widowControl bool Widow/orphan control
direction / dir / bidi rtl / ltr Paragraph reading direction; writes <w:bidi/> on pPr and cascades <w:rtl/> to all child runs and the paragraph mark. See i18n.
font.latin / font.ea / font.cs font name Per-script font slots (Latin / East-Asian / Complex-script) applied to all runs. See i18n.
bold.cs / italic.cs / size.cs bool / bool / pt Complex-script bold/italic/size (required for Arabic/Hebrew rendering)
wordWrap bool Toggle <w:wordWrap/> — controls Latin-word wrapping in CJK paragraphs (mirror of Word's "Allow Latin text to wrap in the middle of a word")
contextualSpacing bool Suppress spaceBefore/spaceAfter between paragraphs of the same style. false omits the element on Add (toggle parity with OOXML default).
numId integer Numbering instance ID (must reference an existing /numbering/num[@id=N]; negative values rejected)
ilvl / numLevel / listLevel 0–8 Numbering level (range-checked; values outside 0..8 are rejected)
shading/shd shading format Background
numId integer Numbering ID
numLevel/ilvl integer (0-8) Numbering level
listStyle bullet, numbered, none Quick list style
start integer List start number
formula LaTeX string Replace content with display math
pbdr.* style;size;color;space Paragraph borders (.top, .bottom, .left, .right, .between, .bar, .all)

Examples

# Change paragraph style
officecli set report.docx /body/p[1] --prop style=Heading1

# Make all text bold and centered
officecli set report.docx /body/p[1] --prop bold=true --prop alignment=center

# Set paragraph borders
officecli set report.docx /body/p[1] --prop "pbdr.bottom=single;4;FF0000;1"

# Change paragraph to a bulleted list
officecli set report.docx /body/p[3] --prop listStyle=bullet

Based on OfficeCLI v1.0.64

Clone this wiki locally