Skip to content

Interface: Slide ​

A slide as the authoring API presents it.

The four settable properties (transition, background, color, slideNumber) admit an explicit undefined, which is not the loophole it looks like under exactOptionalPropertyTypes: SlideBuilder implements them as accessor pairs, so the property is always present on a real slide and its getter answers undefined when nothing is set. There is no absent state for the declaration to describe. Writing one is also how the setters are cleared (slide.transition = undefined removes the p:transition), and an interface that could not express the value its own setter takes would be describing a different type.

Properties ​

addAnimation ​

addAnimation: (options) => Slide

Parameters ​

ParameterType
optionsAnimationProps

Returns ​

Slide


addComment ​

addComment: (options) => Slide

Parameters ​

ParameterType
optionsCommentProps

Returns ​

Slide


addConnector ​

addConnector: (options) => Slide

Parameters ​

ParameterType
optionsConnectorProps

Returns ​

Slide


addGroup ​

addGroup: (children, options?) => Slide

Group child object descriptors into a single PowerPoint group (<p:grpSp>).

Parameters ​

ParameterType
childrenGroupChildProps[]
options?GroupProps

Returns ​

Slide


addImage ​

addImage: (options) => Slide

Parameters ​

ParameterType
optionsImageProps

Returns ​

Slide


addMedia ​

addMedia: (options) => Slide

Parameters ​

ParameterType
optionsMediaProps

Returns ​

Slide


addModel3d ​

addModel3d: (options) => Slide

Embed a 3D model (Insert ▸ 3D Models): a .glb PowerPoint 2019+ renders live.

Parameters ​

ParameterType
optionsModel3dProps

Returns ​

Slide


addNotes ​

addNotes: (notes) => Slide

Parameters ​

ParameterType
notesstring | NotesProps | NotesProps[]

Returns ​

Slide


addOleObject ​

addOleObject: (options) => Slide

Embed an OLE object (Insert ▸ Object) whose bytes travel inside the .pptx.

Parameters ​

ParameterType
optionsOleObjectProps

Returns ​

Slide


addSectionZoom ​

addSectionZoom: (options) => Slide

Add a Section Zoom: a clickable tile that zooms to the start of a named section.

Parameters ​

ParameterType
optionsSectionZoomProps

Returns ​

Slide

Example ​

ts
slide.addSectionZoom({ sectionTitle: 'Results', x: 1, y: 1, w: 3, h: 1.7 })

addShape ​

addShape: (shapeName, options?) => Slide

Parameters ​

ParameterType
shapeNameSHAPE_NAME
options?ShapeProps

Returns ​

Slide


addSlideZoom ​

addSlideZoom: (options) => Slide

Add a Slide Zoom: a clickable tile that zooms to a single target slide (Insert ▸ Zoom).

Parameters ​

ParameterType
optionsSlideZoomProps

Returns ​

Slide

Example ​

ts
slide.addSlideZoom({ target: intro, x: 1, y: 1, w: 3, h: 1.7 })

addSummaryZoom ​

addSummaryZoom: (options) => Slide

Add a Summary Zoom: a grid of tiles, one per section (excluding this slide's own section).

Parameters ​

ParameterType
optionsZoomBaseProps

Returns ​

Slide

Example ​

ts
slide.addSummaryZoom({ x: 0.5, y: 1.5, w: 11, h: 4.5 })

addTable ​

addTable: (tableRows, options?) => Slide

Parameters ​

ParameterType
tableRowsTableRow[]
options?TableProps

Returns ​

Slide


addText ​

addText: (text, options?) => Slide

Parameters ​

ParameterType
textstring | number | TextProps[]
options?TextPropsOptions

Returns ​

Slide


background? ​

optional background?: BackgroundOption

Background color or image (color | path | data)

Examples ​

ts
{ color: 'FF3399' } - hex color
ts
{ color: 'FF3399', transparency:50 } - hex color with 50% transparency
ts
{ path: 'https://onedrives.com/myimg.png` } - retrieve image via URL
	 * @example { path: '/home/user/images/myimg.png` } - retrieve image via local path
	 * @example { data: 'image/png;base64,iVtDaDrF[...]=' } - base64 string

color? ​

optional color?: string

Default text color (hex format): the color of addText and table text that states none itself, on its shape or on its table. Read when the slide is written, so it reaches text added before it was set. Placeholder text and hyperlinks keep inheriting their colors, and a table with a hyperlink in it states no default color at all.

Example ​

ts
'FF3399'

Default ​

ts
'000000' (DEF_FONT_COLOR)

groupObjects ​

groupObjects: (objectNames, options?) => Slide

Group objects already on this slide, addressed by their objectName, into a single group.

Parameters ​

ParameterType
objectNamesstring[]
options?GroupProps

Returns ​

Slide


height? ​

readonly optional height?: number

Slide height in inches, resolved from the active presentation layout.


hidden? ​

optional hidden?: boolean

Whether slide is hidden

Default ​

ts
false

newAutoPagedSlides ​

readonly newAutoPagedSlides: Slide[]

Every continuation slide this slide's auto-paging tables have spilled onto, in call order.

Across calls, and each slide once: a slide can carry several addTables, each appends what it spilled onto, and a later table lands on an earlier one's continuations rather than making its own. So this names all of them rather than only the most recent table's.

Example ​

ts
slide.addTable(rows, { autoPage: true })
for (const made of slide.newAutoPagedSlides) made.addText('continued', { x: 0.5, y: 0.2 })

objects ​

readonly objects: readonly SlideObjectInfo[]

The objects authored on this slide so far, bottom-to-top in z-order: the read-back half of groupObjects(), which addresses those same objects by name but until now gave no way to learn the names.

A fresh snapshot on every access, and inert: it describes the slide, and writing to it does nothing. To act on what it reports, call the authoring API with the names it hands you.

Example ​

ts
const cards = slide.objects.filter((o) => o.canGroup && o.objectName?.startsWith('card:'))
slide.groupObjects(cards.map((o) => o.objectName), { objectName: 'Cards' })

slideNumber? ​

optional slideNumber?: SlideNumberProps

Slide number options


transition? ​

optional transition?: TransitionProps

Slide-show transition played when advancing to this slide (p:transition).

Example ​

ts
slide.transition = { type: 'fade', durationMs: 1500 }

width? ​

readonly optional width?: number

Slide width in inches, resolved from the active presentation layout. Use for coordinate math instead of hard-coding layout dimensions.

Example ​

ts
slide.addText('Centered', { x: 0, w: slide.width, align: 'center' })

Methods ​

addChart() ​

Call Signature ​

addChart(data, options): Slide

Parameters ​
ParameterType
dataOptsChartData[]
optionsChartOpts & object
Returns ​

Slide

Call Signature ​

addChart(charts, options?): Slide

Parameters ​
ParameterType
chartsChartMulti[]
options?ChartOpts
Returns ​

Slide