Class: TextFrame
Constructors
Constructor
new TextFrame(
txBody,context):TextFrame
Parameters
| Parameter | Type | Description |
|---|---|---|
txBody | Element | - |
context | TextContext | What the frame is read against (its part, the theme, the part's relationships and the inheritance its runs fall back through), handed on to each Paragraph and Run. |
Returns
TextFrame
Accessors
autofit
Get Signature
get autofit():
AutofitMode|null
The frame's vertical-autofit mode (a:bodyPr autofit child), or null when there is no a:bodyPr. A bodyPr with no autofit child, or an explicit a:noAutofit, reads 'none'. See AutofitMode. This is the deep-model counterpart of inspectPptx's per-shape autofit; unlike the shallow surface it hangs off the navigable text frame.
Returns
AutofitMode | null
autofitFontScale
Get Signature
get autofitFontScale():
number|null
The baked shrink scale of a normAutofit frame as a percent (62.5 = 62.5%), or null when the frame has no a:normAutofit or bakes no scale. A bare <a:normAutofit/> (write-side fit: 'shrink') carries no scale (PowerPoint computes it on edit and draws at 100% until then), so it too reads null; an explicit scale comes from fit: { type: 'shrink', fontScale }.
Returns
number | null
autofitLineSpaceReduction
Get Signature
get autofitLineSpaceReduction():
number|null
The baked line-spacing reduction of a normAutofit frame as a percent (a:normAutofit/@lnSpcReduction ÷ 1000), or null when unset. The companion to autofitFontScale (write-side fit: { type: 'shrink', lnSpcReduction }).
Returns
number | null
bodyProperties
Get Signature
get bodyProperties():
BodyProperties|null
The frame's body properties (a:bodyPr: insets, anchor, vertical text), or null when there is no a:bodyPr. Only explicitly-set insets are reported (a missing side is the PowerPoint default; see BodyProperties).
Returns
BodyProperties | null
element_
Get Signature
get element_():
Element
Escape hatch: the underlying p:txBody element. After mutating it call markDirty, or save() writes the original bytes.
Returns
Element
paragraphs
Get Signature
get paragraphs():
Paragraph[]
Paragraphs (a:p) in document order.
Returns
resolvedAnchor
Get Signature
get resolvedAnchor():
string|null
The effective vertical anchor (t/ctr/b): the frame's own a:bodyPr/@anchor when set, else the anchor it inherits from its layout → master placeholder a:bodyPr. null when nothing in the chain sets one (PowerPoint then defaults to top). Unlike bodyProperties's anchor (own attribute only), this surfaces the inherited anchor a placeholder title relies on: the difference between a top- and centre-anchored title that own-attribute reads alone cannot see.
Returns
string | null
text
Get Signature
get text():
string
All paragraph text joined by \n (mirrors python-pptx TextFrame.text).
Returns
string
Set Signature
set text(
value):void
Replace the frame's text with a single paragraph and run, preserving the character formatting (a:rPr) of the frame's first existing run when there is one. For multiple runs or per-run formatting, edit paragraphs[].runs[] directly.
Parameters
| Parameter | Type |
|---|---|
value | string |
Returns
void
Methods
listStyleDefaults()
listStyleDefaults(
level?):ListStyleDefaults|null
The character defaults this frame's own list style states for paragraphs at level (0-based): a:lstStyle/a:lvlNpPr/a:defRPr, else a:defPPr/a:defRPr. null when the frame has no list style or it states no defaults for that level.
Only the frame's own tier. What a run inherits through it, and through a placeholder's layout and master, is the run's resolved* reads.
Parameters
| Parameter | Type | Default value |
|---|---|---|
level | number | 0 |
Returns
ListStyleDefaults | null
markDirty()
markDirty():
void
Mark the owning part dirty so save() reserializes it. Call after mutating element_.
Returns
void