Skip to content

Class: Field ​

One text field (a:fld): text PowerPoint computes as it renders, such as a slide number (slidenum) or a date (datetime1). A field carries the same a:rPr a run does, so it reads and resolves its formatting like one. text is the rendering PowerPoint last cached, which it recomputes on open.

Extends ​

Constructors ​

Constructor ​

new Field(element, context, inherited): Field

Parameters ​

ParameterTypeDescription
elementElement-
contextTextContextWhat the run is read against; see TextContext. Its inherit.fontRef is the tier resolvedColor and resolvedFontFace consult just below the run's own a:rPr and above the placeholder and p:defaultTextStyle chain.
inheritedInheritedRunProps | nullWhat the run inherits when it sets no colour, size, face, bold or italic of its own, or null for text that inherits through nothing. Built by the owning Paragraph and shared by its runs; nothing in it is resolved until a run asks.

Returns ​

Field

Inherited from ​

Run.constructor

Accessors ​

baselinePct ​

Get Signature ​

get baselinePct(): number | null

Baseline shift as a percentage of the font size (a:rPr/@baseline, stored in 1000ths of a percent): positive for superscript (the writer's default is 30), negative for subscript (-40), or null when unset. Reported as the percentage (@baseline ÷ 1000).

@baseline is a:ST_Percentage, a union that also admits "62.5%" (the only form the Strict profile has), so it is read through parsePercentPoints rather than as a bare number.

Returns ​

number | null

Inherited from ​

Run.baselinePct


bold ​

Get Signature ​

get bold(): boolean | null

Bold (a:rPr/@b), or null when unset (inherited from style).

Returns ​

boolean | null

Set Signature ​

set bold(value): void

Parameters ​
ParameterType
valueboolean | null
Returns ​

void

Inherited from ​

Run.bold


breaksBefore ​

Get Signature ​

get breaksBefore(): number

How many line breaks (a:br) sit directly before this run in its paragraph, with no run or field between them. A soft break is not a run, so without this the runs on either side of one read as plain neighbours. The read counterpart of the write-side softBreakBefore option.

Returns ​

number

Inherited from ​

Run.breaksBefore


caps ​

Get Signature ​

get caps(): string | null

Capitalization token (a:rPr/@cap: none | small | all), or null when unset. small renders small-caps, all renders all-caps.

Returns ​

string | null

Inherited from ​

Run.caps


charSpacingPt ​

Get Signature ​

get charSpacingPt(): number | null

Character spacing (tracking) in points (a:rPr/@spc, authored in hundredths of a point), or null when unset. Negative tightens. The read counterpart of the write-side charSpacing option.

Returns ​

number | null

Inherited from ​

Run.charSpacingPt


color ​

Get Signature ​

get color(): string | null

Explicit RGB fill colour as a 6-hex string (a:solidFill/a:srgbClr/@val), or null.

Returns ​

string | null

Set Signature ​

set color(value): void

Parameters ​
ParameterType
valuestring | null
Returns ​

void

Inherited from ​

Run.color


eastAsianFontName ​

Get Signature ​

get eastAsianFontName(): string | null

The East Asian typeface (a:rPr/a:ea/@typeface), or null when unset. fontName is the Latin slot. The read counterpart of the write-side fontFaceEA option.

Returns ​

string | null

Inherited from ​

Run.eastAsianFontName


element_ ​

Get Signature ​

get element_(): Element

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

Returns ​

Element

Inherited from ​

Run.element_


fontName ​

Get Signature ​

get fontName(): string | null

Latin typeface name (a:rPr/a:latin/@typeface), or null when unset.

Returns ​

string | null

Set Signature ​

set fontName(value): void

Parameters ​
ParameterType
valuestring | null
Returns ​

void

Inherited from ​

Run.fontName


fontSizePt ​

Get Signature ​

get fontSizePt(): number | null

Font size in points (a:rPr/@sz is hundredths of a point), or null if unset.

Returns ​

number | null

Set Signature ​

set fontSizePt(value): void

Parameters ​
ParameterType
valuenumber | null
Returns ​

void

Inherited from ​

Run.fontSizePt


glow ​

Get Signature ​

get glow(): Glow | null

The run's own glow (a:rPr/a:effectLst/a:glow), resolved against the slide theme, or null. The read counterpart of the write-side text glow option; a shape's glow is Shape.glow.

Returns ​

Glow | null

Inherited from ​

Run.glow


highlight ​

Get Signature ​

get highlight(): ResolvedColor | null

The run's highlight colour (a:rPr/a:highlight), resolved to a literal hex through the owning slide's theme, or null when the run has no highlight or its colour cannot be made literal. The writer authors highlights from a hex colour, so effectiveHex is that colour; imported decks may carry a theme token.

Returns ​

ResolvedColor | null

Inherited from ​

Run.highlight


Get Signature ​

get hyperlink(): Hyperlink | null

The run's click hyperlink (a:rPr/a:hlinkClick), or null when the run carries none. A URL link resolves its @r:id to the external target (Hyperlink.url); a slide jump resolves it to the linked slide's partname (Hyperlink.targetPartName). When the run is read without its part's relationships (see TextContext.rels), only the raw @r:id/@action/@tooltip are reported (the target stays null).

Returns ​

Hyperlink | null

Inherited from ​

Run.hyperlink


innerShadow ​

Get Signature ​

get innerShadow(): InnerShadow | null

The run's own inner shadow (a:rPr/a:effectLst/a:innerShdw), resolved against the slide theme, or null. What a run's shadow: { type: 'inner' } writes.

Returns ​

InnerShadow | null

Inherited from ​

Run.innerShadow


italic ​

Get Signature ​

get italic(): boolean | null

Italic (a:rPr/@i), or null when unset (inherited from style).

Returns ​

boolean | null

Set Signature ​

set italic(value): void

Parameters ​
ParameterType
valueboolean | null
Returns ​

void

Inherited from ​

Run.italic


kerningPt ​

Get Signature ​

get kerningPt(): number | null

Kerning threshold in points (a:rPr/@kern, authored in hundredths of a point), or null when unset: text at this font size or larger is pair-kerned, and 0 means kerning is off. PowerPoint's own default is 12. The read counterpart of the write-side kerning option.

Returns ​

number | null

Inherited from ​

Run.kerningPt


language ​

Get Signature ​

get language(): string | null

The run's language tag (a:rPr/@lang, e.g. fr-FR), or null when unset. Decides spelling, hyphenation and font fallback. The read counterpart of the write-side lang option.

Returns ​

string | null

Inherited from ​

Run.language


outline ​

Get Signature ​

get outline(): RunOutline | null

The run's text outline (a:rPr/a:ln), or null when it has none. The read counterpart of outline.

Returns ​

RunOutline | null

Inherited from ​

Run.outline


resolvedBold ​

Get Signature ​

get resolvedBold(): boolean | null

Whether this run effectively renders bold. It is the run's own @b (bold) when set; otherwise, for a run inside a placeholder, the bold state it inherits from the placeholder/list-style chain (paragraph a:defRPr → slide a:lstStyle → layout → master placeholder a:lstStyle → master p:txStyles). null when the run sets no @b and inherits none. This is the resolved counterpart of bold, which reports only the run's own value.

Returns ​

boolean | null

Inherited from ​

Run.resolvedBold


resolvedColor ​

Get Signature ​

get resolvedColor(): ResolvedColor | null

The colour this run effectively renders, resolved against the owning slide's theme to a literal hex. It is the run's own solid fill (color/schemeColor) when set; otherwise the shape's p:style/a:fontRef colour, then (for a run inside a placeholder) the colour it inherits from the placeholder/list-style chain (layout → master placeholder a:lstStyle → master p:txStyles), then the presentation's p:defaultTextStyle. null when the run sets no colour and inherits none, or the colour cannot be made literal. null too when the run's own fill is not a solid colour (a:noFill, a gradient): the run decides its own colour then, and the one it would otherwise inherit is not what it paints in, the rule Shape.resolvedFill and TableCell.resolvedFill follow. The returned ResolvedColor carries effectiveHex, the base colour with its child transforms (lumMod/shade/…) applied, for the final rendered colour.

Returns ​

ResolvedColor | null

Inherited from ​

Run.resolvedColor


resolvedFontFace ​

Get Signature ​

get resolvedFontFace(): string | null

The typeface this run effectively renders, resolved to a literal face name. It is the run's own a:latin (fontName) when set; otherwise the face named by the shape's p:style/a:fontRef (idx → theme major/minor font), then (for a run inside a placeholder) the face it inherits from the placeholder/list-style chain, then the presentation's p:defaultTextStyle. A +mj-*/+mn-* major/minor theme-font token, on the run itself or reached through the chain, is resolved through the theme fontScheme to its concrete face. null when the run names no face and inherits none, or a token cannot be resolved. This is the resolved counterpart of fontName, which reports the raw @typeface (possibly a token).

Returns ​

string | null

Inherited from ​

Run.resolvedFontFace


resolvedItalic ​

Get Signature ​

get resolvedItalic(): boolean | null

Whether this run effectively renders italic. It is the run's own @i (italic) when set; otherwise, for a run inside a placeholder, the italic state it inherits from the placeholder/list-style chain (paragraph a:defRPr → slide a:lstStyle → layout → master placeholder a:lstStyle → master p:txStyles). null when the run sets no @i and inherits none. This is the resolved counterpart of italic, and the twin of resolvedBold: @b and @i are siblings a master text style states together, so a deck that can be authored with an inherited italic can be read back with one.

Returns ​

boolean | null

Inherited from ​

Run.resolvedItalic


resolvedSizePt ​

Get Signature ​

get resolvedSizePt(): number | null

The point size this run effectively renders. It is the run's own @sz (fontSizePt) when set; otherwise, for a run inside a placeholder, the size it inherits from the placeholder/list-style chain (paragraph a:defRPr → slide a:lstStyle → layout → master placeholder a:lstStyle → master p:txStyles). null when the run sets no size and inherits none. This is the resolved counterpart of fontSizePt, which reports only the run's own value.

Returns ​

number | null

Inherited from ​

Run.resolvedSizePt


schemeColor ​

Get Signature ​

get schemeColor(): string | null

Theme colour token when the fill is a scheme colour (a:schemeClr/@val, e.g. accent2), or null.

Returns ​

string | null

Set Signature ​

set schemeColor(value): void

Throws ​

when the token is not an ST_SchemeColorVal

Parameters ​
ParameterType
valuestring | null
Returns ​

void

Inherited from ​

Run.schemeColor


shadow ​

Get Signature ​

get shadow(): OuterShadow | null

The run's own outer shadow (a:rPr/a:effectLst/a:outerShdw), resolved against the slide theme, or null. The read counterpart of a run's shadow option and of a table cell's, which writes it on every run of the cell; a shape's shadow is Shape.shadow.

Returns ​

OuterShadow | null

Inherited from ​

Run.shadow


strike ​

Get Signature ​

get strike(): string | null

Strikethrough token (a:rPr/@strike: noStrike | sngStrike | dblStrike), or null when unset (inherited from the style). Surfaced as the raw token; sngStrike is the writer's single-strike value.

Returns ​

string | null

Inherited from ​

Run.strike


text ​

Get Signature ​

get text(): string

The run's text (a:t), verbatim; whitespace is not normalized.

Returns ​

string

Set Signature ​

set text(value): void

Parameters ​
ParameterType
valuestring
Returns ​

void

Inherited from ​

Run.text


type ​

Get Signature ​

get type(): string | null

The field type (@type), such as slidenum or datetime1, or null when unset.

Returns ​

string | null


underline ​

Get Signature ​

get underline(): string | null

Underline style token (a:rPr/@u, e.g. sng), or null when unset.

Returns ​

string | null

Set Signature ​

set underline(value): void

Throws ​

when the token is not an ST_TextUnderlineType

Parameters ​
ParameterType
valuestring | null
Returns ​

void

Inherited from ​

Run.underline


underlineColor ​

Get Signature ​

get underlineColor(): ColorRef | null

The underline's own colour (a:rPr/a:uFill/a:solidFill), as written and resolved, or null when the underline follows the text colour. The read counterpart of underline.color.

Returns ​

ColorRef | null

Inherited from ​

Run.underlineColor

Methods ​

markDirty() ​

markDirty(): void

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

Returns ​

void

Inherited from ​

Run.markDirty