Class: Paragraph
One paragraph (a:p) of a text frame.
Constructors
Constructor
new Paragraph(
element,context,slideLstStyle):Paragraph
Parameters
| Parameter | Type | Description |
|---|---|---|
element | Element | - |
context | TextContext | What the paragraph is read against; see TextContext. |
slideLstStyle | Element | null | The 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
endLanguage
Get Signature
get endLanguage():
string|null
The language of the paragraph's end mark (a:endParaRPr/@lang, e.g. fr-FR), or null when unset. It is what text typed at the end of the paragraph, or into an empty one, is spelled in. The write side states it from the text's lang option.
Returns
string | null
equations
Get Signature
get equations():
Equation[]
The OMML equations (a14:m) in document order. An equation is neither a run nor part of text; each says how many runs precede it, so an inline one keeps its place.
Returns
Equation[]
fields
Get Signature
get fields():
Field[]
The fields (a:fld) in document order, each read like a run; see Field.
Returns
Field[]
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
resolvedAlign
Get Signature
get resolvedAlign():
string|null
The alignment the paragraph renders with: its own, else the first its level inherits through the text body's a:lstStyle, the placeholder's layout and master list styles, the master's p:txStyles and the presentation's p:defaultTextStyle, the chain Run.resolvedSizePt walks. null when nothing in the chain states one (PowerPoint then aligns left).
Returns
string | null
resolvedBulletDetail
Get Signature
get resolvedBulletDetail():
BulletDetail|null
The bullet the paragraph renders with: its own bulletDetail, else the first bullet its level inherits, resolved as resolvedAlign is. A picture bullet from an inherited tier reads with imagePartName: null, its image being a relationship of the layout or master. null when nothing in the chain names one.
Returns
BulletDetail | null
resolvedIndentPt
Get Signature
get resolvedIndentPt():
number|null
The first-line indent in points the paragraph renders with, resolved as resolvedAlign is.
Returns
number | null
resolvedLineSpacing
Get Signature
get resolvedLineSpacing():
LineSpacing|null
The line spacing the paragraph renders with, resolved as resolvedAlign is.
Returns
LineSpacing | null
resolvedMarginLeftPt
Get Signature
get resolvedMarginLeftPt():
number|null
The left margin in points the paragraph renders with, resolved as resolvedAlign is.
Returns
number | null
resolvedSpaceAfterPt
Get Signature
get resolvedSpaceAfterPt():
number|null
The space after the paragraph in points, resolved as resolvedAlign is.
Returns
number | null
resolvedSpaceBeforePt
Get Signature
get resolvedSpaceBeforePt():
number|null
The space before the paragraph in points, resolved as resolvedAlign is.
Returns
number | null
rtl
Get Signature
get rtl():
boolean|null
Right-to-left paragraph direction (a:pPr/@rtl), or null when unset (left to right). The read counterpart of the write-side rtlMode option.
Returns
boolean | null
runs
Get Signature
get runs():
Run[]
The runs (a:r) in document order. Fields (a:fld) are not runs (see fields), nor are breaks.
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
tabStops
Get Signature
get tabStops():
TabStop[] |null
The paragraph's own tab stops (a:pPr/a:tabLst/a:tab) in document order, or null when it states no tab list and inherits one. The read counterpart of the write-side tabStops option.
Returns
TabStop[] | 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. That is the difference from TextFrame.text, which collapses the whole body to one paragraph.
Parameters
| Parameter | Type |
|---|---|
value | string |
Returns
void
Methods
markDirty()
markDirty():
void
Mark the owning part dirty so save() reserializes it. Call after mutating element_.
Returns
void