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
| Parameter | Type |
|---|---|
options | AnimationProps |
Returns
Slide
addComment
addComment: (
options) =>Slide
Parameters
| Parameter | Type |
|---|---|
options | CommentProps |
Returns
Slide
addConnector
addConnector: (
options) =>Slide
Parameters
| Parameter | Type |
|---|---|
options | ConnectorProps |
Returns
Slide
addGroup
addGroup: (
children,options?) =>Slide
Group child object descriptors into a single PowerPoint group (<p:grpSp>).
Parameters
| Parameter | Type |
|---|---|
children | GroupChildProps[] |
options? | GroupProps |
Returns
Slide
addImage
addImage: (
options) =>Slide
Parameters
| Parameter | Type |
|---|---|
options | ImageProps |
Returns
Slide
addMedia
addMedia: (
options) =>Slide
Parameters
| Parameter | Type |
|---|---|
options | MediaProps |
Returns
Slide
addModel3d
addModel3d: (
options) =>Slide
Embed a 3D model (Insert ▸ 3D Models): a .glb PowerPoint 2019+ renders live.
Parameters
| Parameter | Type |
|---|---|
options | Model3dProps |
Returns
Slide
addNotes
addNotes: (
notes) =>Slide
Parameters
| Parameter | Type |
|---|---|
notes | string | NotesProps | NotesProps[] |
Returns
Slide
addOleObject
addOleObject: (
options) =>Slide
Embed an OLE object (Insert ▸ Object) whose bytes travel inside the .pptx.
Parameters
| Parameter | Type |
|---|---|
options | OleObjectProps |
Returns
Slide
addSectionZoom
addSectionZoom: (
options) =>Slide
Add a Section Zoom: a clickable tile that zooms to the start of a named section.
Parameters
| Parameter | Type |
|---|---|
options | SectionZoomProps |
Returns
Slide
Example
ts
slide.addSectionZoom({ sectionTitle: 'Results', x: 1, y: 1, w: 3, h: 1.7 })addShape
addShape: (
shapeName,options?) =>Slide
Parameters
| Parameter | Type |
|---|---|
shapeName | SHAPE_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
| Parameter | Type |
|---|---|
options | SlideZoomProps |
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
| Parameter | Type |
|---|---|
options | ZoomBaseProps |
Returns
Slide
Example
ts
slide.addSummaryZoom({ x: 0.5, y: 1.5, w: 11, h: 4.5 })addTable
addTable: (
tableRows,options?) =>Slide
Parameters
| Parameter | Type |
|---|---|
tableRows | TableRow[] |
options? | TableProps |
Returns
Slide
addText
addText: (
text,options?) =>Slide
Parameters
| Parameter | Type |
|---|---|
text | string | number | TextProps[] |
options? | TextPropsOptions |
Returns
Slide
background?
optionalbackground?:BackgroundOption
Background color or image (color | path | data)
Examples
ts
{ color: 'FF3399' } - hex colorts
{ color: 'FF3399', transparency:50 } - hex color with 50% transparencyts
{ 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 stringcolor?
optionalcolor?: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
| Parameter | Type |
|---|---|
objectNames | string[] |
options? | GroupProps |
Returns
Slide
height?
readonlyoptionalheight?:number
Slide height in inches, resolved from the active presentation layout.
hidden?
optionalhidden?:boolean
Whether slide is hidden
Default
ts
falsenewAutoPagedSlides
readonlynewAutoPagedSlides: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
readonlyobjects: readonlySlideObjectInfo[]
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?
optionalslideNumber?:SlideNumberProps
Slide number options
transition?
optionaltransition?:TransitionProps
Slide-show transition played when advancing to this slide (p:transition).
Example
ts
slide.transition = { type: 'fade', durationMs: 1500 }width?
readonlyoptionalwidth?: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
| Parameter | Type |
|---|---|
data | OptsChartData[] |
options | ChartOpts & object |
Returns
Slide
Call Signature
addChart(
charts,options?):Slide
Parameters
| Parameter | Type |
|---|---|
charts | ChartMulti[] |
options? | ChartOpts |
Returns
Slide