Skip to content

word paragraph set

goworm edited this page Jun 26, 2026 · 53 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
spaceBeforeAuto (alias beforeAutospacing) bool Automatic spacing toggle for the space BEFORE the paragraph (w:spacing@beforeAutospacing)
spaceAfterAuto (alias afterAutospacing) bool Automatic spacing toggle for the space AFTER the paragraph (w:spacing@afterAutospacing)
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.
font.asciiTheme / font.hAnsiTheme / font.eaTheme / font.csTheme theme name Theme font bindings for the ascii / hAnsi / eastAsia / complex-script slots (rFonts/*Theme, e.g. minorHAnsi, majorBidi)
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
shading.val shading pattern token Pattern value of a true pattern shading (pct*/stripe/cross). Solid backgrounds use fill/shd
shading.fill hex Fill color of a pattern shading
shading.color hex Foreground (pattern) color of a pattern shading
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)
markRPr.bold / markRPr.italic / markRPr.strike bool Paragraph-mark run (¶ glyph) bold / italic / strike (w:pPr/w:rPr/w:b,w:i,w:strike); inherited by appended runs without their own setting
markRPr.rtl bool Paragraph-mark run right-to-left flag (w:pPr/w:rPr/w:rtl)
markRPr.rStyle style id Paragraph-mark run character style (w:pPr/w:rPr/w:rStyle)
markRPr.underline underline style Paragraph-mark run underline (w:pPr/w:rPr/w:u)
markRPr.size pt Paragraph-mark run font size (w:pPr/w:rPr/w:sz)
markRPr.color hex / scheme color Paragraph-mark run color (w:pPr/w:rPr/w:color)
markRPr.highlight highlight color Paragraph-mark run highlight (w:pPr/w:rPr/w:highlight)
markRPr.font.latin / markRPr.font.ea / markRPr.font.cs font name Paragraph-mark run Ascii / EastAsia / ComplexScript font (w:pPr/w:rPr/w:rFonts @ascii,@eastAsia,@cs)
markRPr.font.ascii / markRPr.font.hAnsi font name Paragraph-mark run Ascii / HighAnsi font, emitted separately only when the two slots diverge (otherwise collapse to markRPr.font.latin)
markRPr.font.hint eastAsia / cs / default Paragraph-mark run font slot hint (w:pPr/w:rPr/w:rFonts @hint)
markRPr.font.asciiTheme / markRPr.font.hAnsiTheme / markRPr.font.eaTheme / markRPr.font.csTheme theme name Paragraph-mark run theme font bindings (w:pPr/w:rPr/w:rFonts/@*Theme)
markRPr.charSpacing pt Paragraph-mark run character spacing (w:pPr/w:rPr/w:spacing)
markRPr.size.cs pt Paragraph-mark run complex-script font size (w:pPr/w:rPr/w:szCs)
markRPr.bold.cs / markRPr.italic.cs bool Paragraph-mark run complex-script bold / italic (w:pPr/w:rPr/w:bCs,w:iCs)
markRPr.kern integer (half-points) Paragraph-mark run kerning threshold (w:pPr/w:rPr/w:kern)
markRPr.lang.latin / markRPr.lang.ea / markRPr.lang.cs BCP-47 tag Paragraph-mark run Latin / East-Asian / complex-script language tags (w:pPr/w:rPr/w:lang @val,@eastAsia,@bidi)

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