Skip to content

@shbernal/pptxgenjs


@shbernal/pptxgenjs / index / TextPropsOptions

Interface: TextPropsOptions

Defined in: core-interfaces.ts:1765

Reusable optional data/path fields. Use DataOrPathRequiredProps for APIs that require at least one source.

Extends

Extended by

Properties

_bodyProp?

optional _bodyProp?: object

Defined in: core-interfaces.ts:1766

align?

optional align?: TEXT_HALIGN

anchor?

optional anchor?: TEXT_VALIGN

autoFit?

optional autoFit?: boolean

bIns?

optional bIns?: number

lIns?

optional lIns?: number

numCol?

optional numCol?: number

prstTxWarp?

optional prstTxWarp?: string

rIns?

optional rIns?: number

spcCol?

optional spcCol?: number

tIns?

optional tIns?: number

vert?

optional vert?: TextVertType

wrap?

optional wrap?: boolean


_lineIdx?

optional _lineIdx?: number

Defined in: core-interfaces.ts:1781


align?

optional align?: HAlign

Defined in: core-interfaces.ts:521

Horizontal alignment

Default

ts
'left'

Inherited from

TextBaseProps.align


altText?

optional altText?: string

Defined in: core-interfaces.ts:807

Alt Text value ("How would you describe this object and its contents to someone who is blind?")

  • serialized to the generated object's p:cNvPr descr attribute
  • PowerPoint: [right-click on the object] > "Edit Alt Text..."

Since

v4.0.0

Example

ts
'Quarterly revenue bar chart'

Inherited from

ObjectNameProps.altText


autoFit?

optional autoFit?: boolean

Defined in: core-interfaces.ts:1927

Whether "Fit to Shape?" is enabled

Deprecated

v3.3.0 - use fit


baseline?

optional baseline?: number

Defined in: core-interfaces.ts:1783


bold?

optional bold?: boolean

Defined in: core-interfaces.ts:526

Bold style

Default

ts
false

Inherited from

TextBaseProps.bold


breakLine?

optional breakLine?: boolean

Defined in: core-interfaces.ts:531

Add a line-break

Default

ts
false

Inherited from

TextBaseProps.breakLine


bullet?

optional bullet?: boolean | { characterCode?: string; code?: string; color?: string; fontFace?: string; image?: { data?: string; path?: string; }; indent?: number; marginPt?: number; numberStartAt?: number; numberType?: "alphaLcParenBoth" | "alphaLcParenR" | "alphaLcPeriod" | "alphaUcParenBoth" | "alphaUcParenR" | "alphaUcPeriod" | "arabicParenBoth" | "arabicParenR" | "arabicPeriod" | "arabicPlain" | "romanLcParenBoth" | "romanLcParenR" | "romanLcPeriod" | "romanUcParenBoth" | "romanUcParenR" | "romanUcPeriod"; size?: number; startAt?: number; style?: string; type?: "number" | "bullet"; }

Defined in: core-interfaces.ts:547

Add standard or custom bullet

  • use true for standard bullet
  • pass object options for custom bullet

Union Members

boolean


Type Literal

{ characterCode?: string; code?: string; color?: string; fontFace?: string; image?: { data?: string; path?: string; }; indent?: number; marginPt?: number; numberStartAt?: number; numberType?: "alphaLcParenBoth" | "alphaLcParenR" | "alphaLcPeriod" | "alphaUcParenBoth" | "alphaUcParenR" | "alphaUcPeriod" | "arabicParenBoth" | "arabicParenR" | "arabicPeriod" | "arabicPlain" | "romanLcParenBoth" | "romanLcParenR" | "romanLcPeriod" | "romanUcParenBoth" | "romanUcParenR" | "romanUcPeriod"; size?: number; startAt?: number; style?: string; type?: "number" | "bullet"; }

characterCode?

optional characterCode?: string

Bullet character code (unicode)

Since

v3.3.0

Example
ts
'25BA' // 'BLACK RIGHT-POINTING POINTER' (U+25BA)
code?

optional code?: string

Bullet code (unicode)

Deprecated

v3.3.0 - use characterCode

color?

optional color?: string

Bullet glyph color (separate from the text run color)

Since

v4.0.0

Example
ts
'FF0000' // red bullet
fontFace?

optional fontFace?: string

Bullet glyph font typeface (<a:buFont/>), e.g. for symbol-font bullets

Since

v4.0.0

Example
ts
'Wingdings' // render `characterCode` using the Wingdings font
image?

optional image?: object

Image to use as the bullet glyph ("picture bullet", <a:buBlip>)

  • supply an image path (filesystem/URL) or base64 data (same forms as addImage())
  • raster formats (PNG/JPG/GIF) are recommended; use size to scale relative to the text height
  • takes precedence over type/characterCode when set
Since

v4.0.0

Examples
ts
image: { path: 'images/star.png' }
ts
image: { data: 'image/png;base64,iVBOR...' }
image.data?

optional data?: string

image.path?

optional path?: string

indent?

optional indent?: number

Indentation (space between bullet and text) (points)

Since

v3.3.0

Default
ts
27 // DEF_BULLET_MARGIN
Example
ts
10 // Indents text 10 points from bullet
marginPt?

optional marginPt?: number

Margin between bullet and text

Since

v3.2.1

Deprecated

v3.3.0 - use indent

numberStartAt?

optional numberStartAt?: number

Number bullets start at

Since

v3.3.0

Default
ts
1
Example
ts
10 // numbered bullets start with 10
numberType?

optional numberType?: "alphaLcParenBoth" | "alphaLcParenR" | "alphaLcPeriod" | "alphaUcParenBoth" | "alphaUcParenR" | "alphaUcPeriod" | "arabicParenBoth" | "arabicParenR" | "arabicPeriod" | "arabicPlain" | "romanLcParenBoth" | "romanLcParenR" | "romanLcPeriod" | "romanUcParenBoth" | "romanUcParenR" | "romanUcPeriod"

Number type

Since

v3.3.0

Example
ts
'romanLcParenR' // roman numerals lower-case with paranthesis right
size?

optional size?: number

Bullet glyph size as a percentage of the run's text size (25–400)

Since

v4.0.0

Default
ts
100
Example
ts
80 // bullet glyph is 80% of the text size
startAt?

optional startAt?: number

Number to start with (only applies to type:number)

Deprecated

v3.3.0 - use numberStartAt

style?

optional style?: string

Number type

Deprecated

v3.3.0 - use numberType

type?

optional type?: "number" | "bullet"

Bullet type

Default
ts
bullet

Default

ts
false

Inherited from

TextBaseProps.bullet


caps?

optional caps?: "small" | "all" | "none"

Defined in: core-interfaces.ts:663

Text capitalization

  • 'all' = ALL CAPS
  • 'small' = Small Caps
  • 'none' = no override (default)
  • PowerPoint: Font > Effects > All Caps / Small Caps

Inherited from

TextBaseProps.caps


charSpacing?

optional charSpacing?: number

Defined in: core-interfaces.ts:1787

Character spacing


color?

optional color?: string

Defined in: core-interfaces.ts:671

Text color

  • HexColor or ThemeColor
  • MS-PPT > Format Shape > Text Options > Text Fill & Outline > Text Fill > Color

Examples

ts
'FF0000' // hex color (red)
ts
pptx.SchemeColor.text1 // Theme color (Text1)

Inherited from

TextBaseProps.color


columns?

optional columns?: number

Defined in: core-interfaces.ts:1796

Number of text columns in the text body

  • PowerPoint: Format Shape > Shape Options > Size & Properties > Text Box > Columns > "Number"
  • range: 1-16

Since

v5.3.0

Default

ts
1

Example

ts
2 // flow text into two columns

columnSpacing?

optional columnSpacing?: number

Defined in: core-interfaces.ts:1805

Spacing between text columns (points)

  • PowerPoint: Format Shape > Shape Options > Size & Properties > Text Box > Columns > "Spacing"
  • only applies when columns > 1

Since

v5.3.0

Default

ts
0

Example

ts
10 // 10pt gap between columns

data?

optional data?: string

Defined in: core-interfaces.ts:74

base64-encoded string

  • Useful for avoiding potential path/server issues

Example

ts
'image/png;base64,iVtDafDrBF[...]=' // pre-encoded image in base-64

Inherited from

DataOrPathProps.data


fill?

optional fill?: ShapeFillProps

Defined in: core-interfaces.ts:1832

Shape fill

Examples

ts
{ color:'FF0000' } // hex color (red)
ts
{ color:'0088CC', transparency:50 } // hex color, 50% transparent
ts
{ color:pptx.SchemeColor.accent1 } // theme color Accent1

fit?

optional fit?: "resize" | "none" | TextFitShrinkProps | "shrink"

Defined in: core-interfaces.ts:1825

Text fit options

MS-PPT > Format Shape > Shape Options > Text Box > "[unlabeled group]": [3 options below]

  • 'none' = Do not Autofit
  • 'shrink' = Shrink text on overflow
  • 'resize' = Resize shape to fit text

Note 'shrink' and 'resize' only take effect after editing text/resize shape. Both PowerPoint and Word dynamically calculate a scaling factor and apply it when edit/resize occurs.

There is no way for this library to trigger that behavior, sorry. As a workaround, pass an object form of 'shrink' to bake explicit fontScale/lnSpcReduction values into the file so the text renders pre-shrunk without an edit/resize.

Since

v3.3.0

Examples

ts
'shrink' // emit a bare <a:normAutofit/>
ts
{ type: 'shrink', fontScale: 85, lnSpcReduction: 20 } // pre-shrink text

Default

ts
"none"

flipH?

optional flipH?: boolean

Defined in: core-interfaces.ts:1837

Flip shape horizontally?

Default

ts
false

flipV?

optional flipV?: boolean

Defined in: core-interfaces.ts:1842

Flip shape vertical?

Default

ts
false

fontFace?

optional fontFace?: string

Defined in: core-interfaces.ts:681

Font face name

Applied to the Latin (<a:latin>) and complex-script (<a:cs>) font slots, matching how PowerPoint writes a font picked from the UI. The East Asian slot (<a:ea>) is left to inherit from the theme unless fontFaceEA is set — forcing a Latin-only face into the East Asian slot duplicates/ghosts text in Office 365.

Example

ts
'Arial' // Arial font

Inherited from

TextBaseProps.fontFace


fontFaceEA?

optional fontFaceEA?: string

Defined in: core-interfaces.ts:689

East Asian font face name (<a:ea> slot), used to render CJK (Chinese/Japanese/Korean) glyphs

Set this when the East Asian font differs from fontFace. When omitted, <a:ea> inherits the theme East Asian font, which is what PowerPoint does for Latin fonts.

Example

ts
'微軟正黑體' // render East Asian glyphs with Microsoft JhengHei

Inherited from

TextBaseProps.fontFaceEA


fontSize?

optional fontSize?: number

Defined in: core-interfaces.ts:694

Font size

Example

ts
12 // Font size 12

Inherited from

TextBaseProps.fontSize


glow?

optional glow?: TextGlowProps

Defined in: core-interfaces.ts:1843


h?

optional h?: Coord

Defined in: core-interfaces.ts:47

Height

  • inches or percentage

Examples

ts
10.25 // height in inches
ts
'75%' // height as percentage of slide size

Inherited from

PositionProps.h


highlight?

optional highlight?: string

Defined in: core-interfaces.ts:699

Text highlight color (hex format)

Example

ts
'FFFF00' // yellow

Inherited from

TextBaseProps.highlight


optional hyperlink?: HyperlinkProps

Defined in: core-interfaces.ts:1844


indentLevel?

optional indentLevel?: number

Defined in: core-interfaces.ts:1845


inset?

optional inset?: number

Defined in: core-interfaces.ts:1937

Inset

Deprecated

v3.10.0 - use margin


isTextBox?

optional isTextBox?: boolean

Defined in: core-interfaces.ts:1846


italic?

optional italic?: boolean

Defined in: core-interfaces.ts:704

italic style

Default

ts
false

Inherited from

TextBaseProps.italic


lang?

optional lang?: string

Defined in: core-interfaces.ts:711

language

  • ISO 639-1 standard language code

Default

ts
'en-US' // english US

Example

ts
'fr-CA' // french Canadian

Inherited from

TextBaseProps.lang


line?

optional line?: ShapeLineProps

Defined in: core-interfaces.ts:1847


lineDash?

optional lineDash?: "dash" | "solid" | "dashDot" | "lgDash" | "lgDashDot" | "lgDashDotDot" | "sysDash" | "sysDot"

Defined in: core-interfaces.ts:1942

Dash type

Deprecated

v3.3.0 - use line.dashType


lineHead?

optional lineHead?: "none" | "triangle" | "arrow" | "diamond" | "oval" | "stealth"

Defined in: core-interfaces.ts:1946

Deprecated

v3.3.0 - use line.beginArrowType


lineSize?

optional lineSize?: number

Defined in: core-interfaces.ts:1950

Deprecated

v3.3.0 - use line.width


lineSpacing?

optional lineSpacing?: number

Defined in: core-interfaces.ts:1853

Line spacing (pt)

  • PowerPoint: Paragraph > Indents and Spacing > Line Spacing: > "Exactly"

Example

ts
28 // 28pt

lineSpacingMultiple?

optional lineSpacingMultiple?: number

Defined in: core-interfaces.ts:1861

line spacing multiple (percent)

  • range: 0.0-9.99
  • PowerPoint: Paragraph > Indents and Spacing > Line Spacing: > "Multiple"

Example

ts
1.5 // 1.5X line spacing

Since

v3.5.0


lineTail?

optional lineTail?: "none" | "triangle" | "arrow" | "diamond" | "oval" | "stealth"

Defined in: core-interfaces.ts:1954

Deprecated

v3.3.0 - use line.endArrowType


margin?

optional margin?: Margin

Defined in: core-interfaces.ts:1871

Margin (points)

  • PowerPoint: Format Shape > Shape Options > Size & Properties > Text Box > Left/Right/Top/Bottom margin

Default

ts
"Normal" margin in PowerPoint [3.5, 7.0, 3.5, 7.0] // (this library sets no value, but PowerPoint defaults to "Normal" [0.05", 0.1", 0.05", 0.1"])

Examples

ts
0 // Top/Right/Bottom/Left margin 0 [0.0" in powerpoint]
ts
10 // Top/Right/Bottom/Left margin 10 [0.14" in powerpoint]
ts
[10,5,10,5] // Top margin 10, Right margin 5, Bottom margin 10, Left margin 5

objectLock?

optional objectLock?: ObjectLockProps

Defined in: core-interfaces.ts:819

Object lock flags (DrawingML a:spLocks / a:picLocks / a:graphicFrameLocks)

  • restrict how the object can be manipulated in PowerPoint (e.g. prevent moving, resizing, or grouping)
  • each flag maps 1:1 to the OOXML attribute of the same name; only flags set to true are emitted
  • PowerPoint UI: Selection Pane / right-click protections (most locks are honored at edit time, not as a password)
  • flags only apply to the object types that support them (see each flag); flags set on an unsupported object type are ignored with a console warning

Since

v4.0.0

Examples

ts
{ noMove: true, noResize: true } // pin an object in place
ts
{ noGrp: true } // exclude from grouping

Inherited from

ObjectNameProps.objectLock


objectName?

optional objectName?: string

Defined in: core-interfaces.ts:799

Object name

  • used instead of default "Object N" name
  • PowerPoint: Home > Arrange > Selection Pane...

Since

v3.10.0

Default

ts
'Object 1'

Example

ts
'Antenna Design 9'

Inherited from

ObjectNameProps.objectName


outline?

optional outline?: object

Defined in: core-interfaces.ts:1872

color

color: string

size

size: number


paraSpaceAfter?

optional paraSpaceAfter?: number

Defined in: core-interfaces.ts:1873


paraSpaceBefore?

optional paraSpaceBefore?: number

Defined in: core-interfaces.ts:1874


path?

optional path?: string

Defined in: core-interfaces.ts:67

URL or relative path

Example

ts
'https://onedrives.com/myimg.png` // retrieve image via URL
@example '/home/gitbrent/images/myimg.png` // retrieve image via local path

Inherited from

DataOrPathProps.path


placeholder?

optional placeholder?: string

Defined in: core-interfaces.ts:1886

Placeholder type

  • when the value matches a placeholder defined on the slide layout/master, this text inherits that placeholder's position and formatting
  • otherwise the text shape is promoted to a standalone placeholder of this type, emitting a real <p:ph type="...">. Use placeholder: 'title' to give a slide an accessible title (PowerPoint's accessibility checker otherwise reports "Missing Slide Title")
  • values: 'title' | 'body' | et. al.

Example

ts
'title'

See

https://learn.microsoft.com/en-us/office/vba/api/powerpoint.ppplaceholdertype


rectRadius?

optional rectRadius?: number

Defined in: core-interfaces.ts:1892

Rounded rectangle radius (only for pptx.shapes.ROUNDED_RECTANGLE)

  • values: 0.0 to 1.0

Default

ts
0

rotate?

optional rotate?: number

Defined in: core-interfaces.ts:1899

Rotation (degrees)

  • range: -360 to 360

Default

ts
0

Example

ts
180 // rotate 180 degrees

rtlMode?

optional rtlMode?: boolean

Defined in: core-interfaces.ts:1904

Whether to enable right-to-left mode

Default

ts
false

shadow?

optional shadow?: ShadowProps

Defined in: core-interfaces.ts:1905


shape?

optional shape?: SHAPE_NAME

Defined in: core-interfaces.ts:1906


shrinkText?

optional shrinkText?: boolean

Defined in: core-interfaces.ts:1932

Whather "Shrink Text on Overflow?" is enabled

Deprecated

v3.3.0 - use fit


softBreakBefore?

optional softBreakBefore?: boolean

Defined in: core-interfaces.ts:717

Add a soft line-break (shift+enter) before line text content

Default

ts
false

Since

v3.5.0

Inherited from

TextBaseProps.softBreakBefore


strike?

optional strike?: boolean | "dblStrike" | "sngStrike"

Defined in: core-interfaces.ts:1907


subscript?

optional subscript?: boolean

Defined in: core-interfaces.ts:1908


superscript?

optional superscript?: boolean

Defined in: core-interfaces.ts:1909


tabStops?

optional tabStops?: object[]

Defined in: core-interfaces.ts:723

tab stops

  • PowerPoint: Paragraph > Tabs > Tab stop position

alignment?

optional alignment?: "r" | "ctr" | "l" | "dec"

position

position: number

Example

ts
[{ position:1 }, { position:3 }] // Set first tab stop to 1 inch, set second tab stop to 3 inches

Inherited from

TextBaseProps.tabStops


textDirection?

optional textDirection?: "horz" | "vert" | "vert270" | "wordArtVert"

Defined in: core-interfaces.ts:732

text direction horz = horizontal vert = rotate 90^ vert270 = rotate 270^ wordArtVert = stacked

Default

ts
'horz'

Inherited from

TextBaseProps.textDirection


textWarp?

optional textWarp?: string

Defined in: core-interfaces.ts:540

Preset text warp / WordArt shape (<a:bodyPr><a:prstTxWarp prst="..">), which bends the text along a preset path (arch, circle, wave, …). The value is an OOXML ST_TextShapeType preset name.

Since

v4.0.0

Examples

ts
'textArchUp' // bend text along an upward arch (e.g. a label following a ring/arc)
ts
'textCircle'

Inherited from

TextBaseProps.textWarp


transparency?

optional transparency?: number

Defined in: core-interfaces.ts:739

Transparency (percent)

  • MS-PPT > Format Shape > Text Options > Text Fill & Outline > Text Fill > Transparency
  • range: 0-100

Default

ts
0

Inherited from

TextBaseProps.transparency


underline?

optional underline?: object

Defined in: core-interfaces.ts:745

underline properties

  • PowerPoint: Font > Color & Underline > Underline Style/Underline Color

color?

optional color?: string

style?

optional style?: "none" | "dash" | "dashHeavy" | "dashLong" | "dashLongHeavy" | "dbl" | "dotDash" | "dotDashHeave" | "dotDotDash" | "dotDotDashHeavy" | "dotted" | "dottedHeavy" | "heavy" | "sng" | "wavy" | "wavyDbl" | "wavyHeavy"

Default

ts
(none)

Inherited from

TextBaseProps.underline


valign?

optional valign?: VAlign

Defined in: core-interfaces.ts:1914

Vertical alignment

Default

ts
middle

Overrides

TextBaseProps.valign


vert?

optional vert?: TextVertType

Defined in: core-interfaces.ts:1915


w?

optional w?: Coord

Defined in: core-interfaces.ts:54

Width

  • inches or percentage

Examples

ts
10.25 // width in inches
ts
'75%' // width as percentage of slide size

Inherited from

PositionProps.w


wrap?

optional wrap?: boolean

Defined in: core-interfaces.ts:1921

Text wrap

Since

v3.3.0

Default

ts
true

x?

optional x?: Coord

Defined in: core-interfaces.ts:33

Horizontal position

  • inches or percentage

Examples

ts
10.25 // position in inches
ts
'75%' // position as percentage of slide size

Inherited from

PositionProps.x


y?

optional y?: Coord

Defined in: core-interfaces.ts:40

Vertical position

  • inches or percentage

Examples

ts
10.25 // position in inches
ts
'75%' // position as percentage of slide size

Inherited from

PositionProps.y