Skip to content

Class: Paragraph ​

One paragraph (a:p) of a text frame.

Constructors ​

Constructor ​

new Paragraph(element, context, slideLstStyle): Paragraph

Parameters ​

ParameterTypeDescription
elementElement-
contextTextContextWhat the paragraph is read against; see TextContext.
slideLstStyleElement | nullThe owning text body's own a:lstStyle, the tier just below the paragraph in the chain its runs inherit through. Read only when TextContext.inherit is set.

Returns ​

Paragraph

Accessors ​

align ​

Get Signature ​

get align(): string | null

Horizontal alignment token (a:pPr/@algn: l | ctr | r | just | dist | thaiDist), or null when unset (inherited from the list style).

Returns ​

string | null


bulletDetail ​

Get Signature ​

get bulletDetail(): BulletDetail | null

This paragraph's bullet — its kind, and for a drawn bullet the glyph, the numbering start, and the bullet's own font/size/colour. null when the paragraph names no bullet at all and inherits one from the list style.

Structured rather than a tagged string, which is not merely tidier. The previous bullet accessor reported 'none' / 'char:•' / 'autoNum:arabicPeriod', and that shape is ambiguous when the glyph is itself a colon; worse, it reads as a bare glyph, which is exactly how the script converter first consumed it — 'none'.codePointAt(0) put a literal n bullet on every converted deck, silently. See BulletDetail.

Returns ​

BulletDetail | null


element_ ​

Get Signature ​

get element_(): Element

Escape hatch: the underlying a:p element. After mutating it call markDirty, or save() writes the original bytes.

Returns ​

Element


indentPt ​

Get Signature ​

get indentPt(): number | null

First-line indent in points (a:pPr/@indent is EMU; negative for a hanging indent), or null when unset.

Returns ​

number | null


level ​

Get Signature ​

get level(): number

Indent level (a:pPr/@lvl), 0 when unset.

Returns ​

number


lineSpacing ​

Get Signature ​

get lineSpacing(): LineSpacing | null

The paragraph's line spacing (a:pPr/a:lnSpc), as an exact point height (a:spcPts) or a percentage of the single-line height (a:spcPct), or null when unset (inherited from the list style). See LineSpacing.

Returns ​

LineSpacing | null


marginLeftPt ​

Get Signature ​

get marginLeftPt(): number | null

Left margin of the paragraph in points (a:pPr/@marL is EMU; 12700 EMU = 1pt), or null when unset.

Returns ​

number | null


runs ​

Get Signature ​

get runs(): Run[]

The runs (a:r) in document order. Fields (a:fld) and breaks are not runs; see text.

Returns ​

Run[]


spaceAfterPt ​

Get Signature ​

get spaceAfterPt(): number | null

Space after the paragraph in points; see spaceBeforePt for the percentage caveat.

Returns ​

number | null


spaceBeforePt ​

Get Signature ​

get spaceBeforePt(): number | null

Space before the paragraph in points (a:pPr/a:spcBef/a:spcPts/@val is hundredths of a point), or null when unset or expressed as a percentage (a:spcPct, which has no fixed point value).

Returns ​

number | null


text ​

Get Signature ​

get text(): string

The paragraph's text: run (a:r) and field (a:fld) text concatenated in document order, with each line break (a:br) rendered as \n.

Returns ​

string

Set Signature ​

set text(value): void

Replace this paragraph's content with a single run, preserving the character formatting (a:rPr) of its first existing run and leaving its a:pPr (level, alignment, bullet) alone. Sibling paragraphs are untouched — the difference from TextFrame.text, which collapses the whole body to one paragraph.

Parameters ​
ParameterType
valuestring
Returns ​

void

Methods ​

markDirty() ​

markDirty(): void

Mark the owning part dirty so save() reserializes it. Call after mutating element_.

Returns ​

void