Skip to main content

Show.Slide

Show.Slide is an object type of the Presentation module (Office.show(iframe)). 60 methods.

Generated from the SDK type definitions

Presentation · 10 object types · 586 methods · namespace Show. This reference is generated from the API document artifact (sdk-api-doc.html) produced with the SDK build. Descriptions are the editor's API comments as published. Pin the SDK and Office versions together and regenerate when either changes.

Remarks

Methods

MethodDescription
appendSlideNoteText(text)Appends text to the end of the slide notes.
deleteComment(commentProxy)Deletes one comment.
deleteComments(commentProxyList)Deletes multiple comments at once.
deleteShape(shapeProxy)Deletes one shape.
deleteShapes(shapeProxyList)Deletes multiple shapes at once.
distributeShapes(shapeProxyList, direction)Distributes multiple shapes evenly.
duplicateShape(shapeProxy)Duplicates the shape.
duplicateShapes(shapeProxyList)Duplicates the shapes.
findCharts(filter)Returns the charts matching the criteria as an array.
findComments(filter)Searches comments matching the criteria.
findShapes(filter)Searches shapes matching the criteria.
findTables(filter)Searches tables matching the criteria.
findText(query, caseSensitive)Searches text in this slide.
getBackgroundFill()Returns the background fill explicitly set on the slide (symmetric with setSolidFill/setGradientFill/setImageFill).
getColorScheme()Returns the color theme applied to this slide.
getComments()Returns the slide's top-level comments (replies excluded).
getDate()Returns the date header/footer setting (symmetric with setDate).
getFooter()Returns the footer text.
getLayoutType()Returns the layout kind applied to the slide.
getNextComment(commentProxy)Returns the next top-level comment, following the UI's note navigation.
getPrevComment(commentProxy)Returns the previous top-level comment, following the UI's note navigation.
getShape(index)Gets a shape by index.
getShapes()Returns all shapes on the slide.
getSlideNoteText()Returns the slide notes text as plain text.
getTransition()Returns the slide transition in setTransition's flat input shape (symmetric with setTransition).
groupShapes(shapeProxyList)Groups several shapes into one group.
hide(isHidden)Sets this slide's hidden state.
insertComment(text)Adds a comment.
insertImage(url)Inserts a web image.
insertShape(presetId, transform)Inserts a shape.
insertTable(rowNum, colNum, styleName)Inserts a table.
insertTextBox(transform)Inserts a text box.
insertWebVideo(url)Inserts a web video (YouTube / 3DS).
isHidden()Returns whether the slide is hidden.
isShowMasterShapes()Returns whether the background shapes of the master (layout) are shown, as set on this slide.
isSlideNumberVisible()Returns whether the slide number is shown.
previewTransition(autoPreview)Plays a preview of this slide's transition effect on screen.
removeDate()Removes this slide's date header/footer.
removeFill()Removes the slide background fill.
removeFooter()Removes this slide's footer.
removeSlideNumber()Removes this slide's slide number.
removeTransition()Removes the transition effect.
replaceText(query, replacement, caseSensitive)Finds the search text in this slide and replaces every match (replace all).
replyComment(commentProxy, text)Adds a reply to a comment.
resetBackground()Resets the slide background.
resetLayout()Resets the slide layout.
saveAsPicture(shapeProxyList)Saves the slide's shapes as a single image.
setDate(date)Sets this slide's date header/footer.
setFill(fill)Applies a fill object returned by getBackgroundFill() straight to the slide background (symmetric with getBackgroundFill).
setFooter(text)Sets this slide's footer.
setGradientFill(type, stops, angle)Sets the slide background to a gradient.
setImageFill(imageUrl, fillMode, alpha, detail)Sets the slide background to an image.
setLayout(layoutType)Applies a layout to the slide.
setPatternFill(preset, foreColor, backColor, foreAlpha, backAlpha)Sets the slide background to a pattern (symmetric with the getBackgroundFill round trip - setFill's pattern path).
setShowMasterShapes(show)Sets whether the master (layout) background shapes are shown.
setSlideNoteText(text)Sets the slide notes text.
setSlideNumber()Shows the slide number on this slide.
setSolidFill(color, alpha)Sets the slide background to a solid color.
setTransition(transition)Sets the slide transition.
ungroupShapes(shapeProxy)Ungroups a group into its child shapes.

Method details

appendSlideNoteText(text)

Appends text to the end of the slide notes.

appendSlideNoteText(text: string): Promise<void>;

Parameters

NameTypeDescription
textstringNote text to append

Returns

Promise<void>

deleteComment(commentProxy)

Deletes one comment. Deleting a parent comment also deletes its replies.

deleteComment(commentProxy: Comment): Promise<void>;

Parameters

NameTypeDescription
commentProxyCommentComment to delete

Returns

Promise<void>

deleteComments(commentProxyList)

Deletes multiple comments at once. When parent comments are included, their replies are deleted too. (Matches the UI behavior.)

deleteComments(commentProxyList: Comment[]): Promise<void>;

Parameters

NameTypeDescription
commentProxyListComment[]Array of comments to delete

Returns

Promise<void>

deleteShape(shapeProxy)

Deletes one shape.

deleteShape(shapeProxy: Shape | Image | Line | Group | Chart | Table | Diagram | OleObject | Control): Promise<void>;

Parameters

NameTypeDescription
shapeProxyShape | Image | Line | Group | Chart | Table | Diagram | OleObject | ControlShape proxy to delete

Returns

Promise<void>

deleteShapes(shapeProxyList)

Deletes multiple shapes at once.

deleteShapes(shapeProxyList: (Shape | Image | Line | Group | Chart | Table | Diagram | OleObject | Control)[]): Promise<void>;

Parameters

NameTypeDescription
shapeProxyList(Shape | Image | Line | Group | Chart | Table | Diagram | OleObject | Control)[]Array of shape proxies to delete

Returns

Promise<void>

distributeShapes(shapeProxyList, direction)

Distributes multiple shapes evenly. After sorting by bbox center, repositions them so the gaps between the end shapes are all equal. (No change with fewer than 2.)

distributeShapes(
shapeProxyList: (Shape | Image | Line | Group | Chart | Table | Diagram | OleObject | Control)[],
direction: DistributeDirection
): Promise<void>;

Parameters

NameTypeDescription
shapeProxyList(Shape | Image | Line | Group | Chart | Table | Diagram | OleObject | Control)[]Array of shape proxies to distribute
directionDistributeDirectionDistribution direction

Returns

Promise<void>

duplicateShape(shapeProxy)

Duplicates the shape. Charts cannot be duplicated and return null.

duplicateShape(shapeProxy: Shape | Image | Line | Group | Chart | Table | Diagram | OleObject | Control): Promise<Shape>;

Parameters

NameTypeDescription
shapeProxyShape | Image | Line | Group | Chart | Table | Diagram | OleObject | ControlShape proxy to duplicate

Returns

Promise<Shape> - The newly created shape proxy

duplicateShapes(shapeProxyList)

Duplicates the shapes. Charts cannot be duplicated and are excluded from the result.

duplicateShapes(shapeProxyList: (Shape | Image | Line | Group | Chart | Table | Diagram | OleObject | Control)[]): Promise<Shape[]>;

Parameters

NameTypeDescription
shapeProxyList(Shape | Image | Line | Group | Chart | Table | Diagram | OleObject | Control)[]Array of shape proxies to duplicate

Returns

Promise<Shape[]> - Array of newly created shape proxies

findCharts(filter)

Returns the charts matching the criteria as an array.

findCharts(filter?: ChartFilter): Promise<Chart[]>;

Parameters

NameTypeDescription
filter (optional)ChartFilterSearch criteria (default: all charts)

Returns

Promise<Chart[]>

findComments(filter)

Searches comments matching the criteria.

findComments(filter?: CommentFilter): Promise<Comment[]>;

Parameters

NameTypeDescription
filter (optional)CommentFilterSearch criteria (default: all comments)

Returns

Promise<Comment[]> - List of matching comments

findShapes(filter)

Searches shapes matching the criteria.

findShapes(filter?: ShapeFilter): Promise<Shape[]>;

Parameters

NameTypeDescription
filter (optional)ShapeFilterSearch criteria (default: all shapes)

Returns

Promise<Shape[]> - List of matching shapes

findTables(filter)

Searches tables matching the criteria.

findTables(filter?: TableFilter): Promise<Table[]>;

Parameters

NameTypeDescription
filter (optional)TableFilterSearch criteria (default: all tables)

Returns

Promise<Table[]> - List of matching tables

findText(query, caseSensitive)

Searches text in this slide. Matches are returned in shape → table cell order. Merged table cells, auto-updating fields such as slide number/date, and matches crossing paragraph boundaries are not found.

findText(
query: string,
caseSensitive?: boolean
): Promise<{ target: (TableCell | Shape); range: { from: number; to: number }; text: string }[]>;

Parameters

NameTypeDescription
querystringText to find
caseSensitive (optional)booleanCase-sensitive (default: false)

Returns

Promise<{ target: (TableCell | Shape); range: { from: number; to: number }; text: string }[]> - List of matches. target is a TableCell for a table-cell match, otherwise a shape proxy (Shape); range (character offsets, to inclusive) can be passed straight to the formatting APIs to edit only the matched span (e.g. m.target.setBold(true, m.range)). text is the matched text at search time.

getBackgroundFill()

Returns the background fill explicitly set on the slide (symmetric with setSolidFill/setGradientFill/setImageFill). Backgrounds inherited from the layout/master are not included; without a slide-level background, \{ type: "none" \}.

getBackgroundFill(): Promise<Fill | null>;

Returns

Promise<Fill | null> - background fill information; null when there is no target slide

getColorScheme()

Returns the color theme applied to this slide. Without a slide override, the master (document) theme is returned.

getColorScheme(): Promise<{ prst: string | null; name: string; colors: Record<string, unknown> } | null>;

Returns

Promise<{ prst: string | null; name: string; colors: Record<string, unknown> } | null> - color theme (prst: filled only when the theme is one listed by doc.getColorSchemeList(); name: display name; colors: slot name to #RRGGBB). null when there is no target slide

getComments()

Returns the slide's top-level comments (replies excluded).

getComments(): Promise<Comment[]>;

Returns

Promise<Comment[]> - List of comments

getDate()

Returns the date header/footer setting (symmetric with setDate). An auto-updating date is returned as { format, language } and a fixed text date as { text }.

getDate(): Promise<HeaderFooterDate | null>;

Returns

Promise<HeaderFooterDate | null> - date setting; null when there is no date header/footer or no target slide. A value stored in the file outside DateFormat/DateLanguage leaves that field out

getFooter()

Returns the footer text.

getFooter(): Promise<string | null>;

Returns

Promise<string | null> - footer text; null when there is no footer or no target slide

getLayoutType()

Returns the layout kind applied to the slide. (Symmetric with setLayout.)

getLayoutType(): Promise<SlideLayoutType | null>;

Returns

Promise<SlideLayoutType | null> - Layout type. null if none

getNextComment(commentProxy)

Returns the next top-level comment, following the UI's note navigation.

getNextComment(commentProxy: Comment): Promise<Comment>;

Parameters

NameTypeDescription
commentProxyCommentReference top-level comment

Returns

Promise<Comment> - The next comment (null if none)

getPrevComment(commentProxy)

Returns the previous top-level comment, following the UI's note navigation.

getPrevComment(commentProxy: Comment): Promise<Comment>;

Parameters

NameTypeDescription
commentProxyCommentReference top-level comment

Returns

Promise<Comment> - The previous comment (null if none)

getShape(index)

Gets a shape by index.

getShape(index: number): Promise<Shape>;

Parameters

NameTypeDescription
indexnumber0-based

Returns

Promise<Shape> - The shape (null if out of range)

getShapes()

Returns all shapes on the slide.

getShapes(): Promise<Shape[]>;

Returns

Promise<Shape[]> - List of shapes

getSlideNoteText()

Returns the slide notes text as plain text. Without a notes slide, returns an empty string without creating one.

getSlideNoteText(): Promise<string | null>;

Returns

Promise<string | null> - note text; null when there is no target slide

getTransition()

Returns the slide transition in setTransition's flat input shape (symmetric with setTransition). Standard effects round-trip fully; Hanshow extended-save cases (diagonal wipe/strips as wipeout, plus-inside as fourboxwipe) restore partially: wipeout comes back as type=strips (a diagonal wipe and strips are the same animation, unified as strips), and values that are not setTransition inputs (dur/spokes, etc.) are not returned.

getTransition(): Promise<Transition | null>;

Returns

Promise<Transition | null> - transition setting; null when there is no transition or no target slide

groupShapes(shapeProxyList)

Groups several shapes into one group. The grouped shapes are recreated as children of the group, so the proxies you passed are no longer valid. Get the children again with getChildren() on the returned group.

groupShapes(shapeProxyList: (Shape | Image | Line | Group | Chart | Table | Diagram | OleObject | Control)[]): Promise<Group>;

Parameters

NameTypeDescription
shapeProxyList(Shape | Image | Line | Group | Chart | Table | Diagram | OleObject | Control)[]array of shape proxies to group (throws with fewer than two)

Returns

Promise<Group> - the created group shape (null on failure)

hide(isHidden)

Sets this slide's hidden state.

hide(isHidden: boolean): Promise<void>;

Parameters

NameTypeDescription
isHiddenbooleantrue: hide the slide, false: show the slide

Returns

Promise<void>

insertComment(text)

Adds a comment.

insertComment(text: string): Promise<Comment>;

Parameters

NameTypeDescription
textstringComment text

Returns

Promise<Comment> - The created comment (null on failure)

insertImage(url)

Inserts a web image.

insertImage(url: string): Promise<Image>;

Parameters

NameTypeDescription
urlstringImage URL

Returns

Promise<Image> - The inserted image shape proxy

insertShape(presetId, transform)

Inserts a shape.

insertShape(
presetId?: ShapePreset,
transform?: { x?: number; y?: number; width?: number; height?: number; angle?: number }
): Promise<Shape>;

Parameters

NameTypeDescription
presetId (optional)ShapePresetShape preset ID (see the ShapePreset enum) (default: ShapePreset.RECT)
transform (optional){ x?: number; y?: number; width?: number; height?: number; angle?: number }Position/size (px) (default: centered on the slide, default size)
transform.x (optional)numberX coordinate (px) (default: horizontally centered)
transform.y (optional)numberY coordinate (px) (default: vertically centered)
transform.width (optional)numberWidth (px) (default: the preset's default size)
transform.height (optional)numberHeight (px) (default: the preset's default size)
transform.angle (optional)numberRotation angle (degrees) (default: 0)

Returns

Promise<Shape> - The inserted shape

insertTable(rowNum, colNum, styleName)

Inserts a table.

insertTable(rowNum: number, colNum: number, styleName?: string): Promise<Table>;

Parameters

NameTypeDescription
rowNumnumberNumber of rows
colNumnumberNumber of columns
styleName (optional)stringTable style name (from doc.getTableStyleNames()). Throws if the name is not in the list (default: the document's default style)

Returns

Promise<Table> - The inserted table

insertTextBox(transform)

Inserts a text box. After inserting, put text via the returned proxy's setText/insertText.

insertTextBox(transform?: { x?: number; y?: number; width?: number; height?: number; angle?: number }): Promise<Shape>;

Parameters

NameTypeDescription
transform (optional){ x?: number; y?: number; width?: number; height?: number; angle?: number }Position/size (px) (default: centered on the slide, default size)
transform.x (optional)numberX coordinate (px) (default: horizontally centered)
transform.y (optional)numberY coordinate (px) (default: vertically centered)
transform.width (optional)numberWidth (px) (default: default size)
transform.height (optional)numberHeight (px) (default: default size)
transform.angle (optional)numberRotation angle (degrees) (default: 0)

Returns

Promise<Shape>

insertWebVideo(url)

Inserts a web video (YouTube / 3DS).

insertWebVideo(url: string): Promise<Image>;

Parameters

NameTypeDescription
urlstringWeb video URL (YouTube watch/embed/shorts/youtu.be, 3DS media)

Returns

Promise<Image> - The inserted web video shape proxy

isHidden()

Returns whether the slide is hidden.

isHidden(): Promise<boolean | null>;

Returns

Promise<boolean | null> - true for a hidden slide. null when there is no target slide

isShowMasterShapes()

Returns whether the background shapes of the master (layout) are shown, as set on this slide.

isShowMasterShapes(): Promise<boolean | null>;

Returns

Promise<boolean | null> - true when the master shapes are shown. null when there is no target slide

isSlideNumberVisible()

Returns whether the slide number is shown.

isSlideNumberVisible(): Promise<boolean | null>;

Returns

Promise<boolean | null> - true when the slide number is shown. null when there is no target slide

previewTransition(autoPreview)

Plays a preview of this slide's transition effect on screen. Previews only work on the slide currently in view, so if this slide is not current it throws instead of playing - go to it first with goToSlide. A display-only action that does not modify the document.

previewTransition(autoPreview?: boolean): Promise<void>;

Parameters

NameTypeDescription
autoPreview (optional)booleanWhen given, toggles the 'auto preview' setting on/off instead of playing (whether to auto-play the preview when a transition is set; an app-wide setting) (default: none (plays the preview immediately))

Returns

Promise<void>

removeDate()

Removes this slide's date header/footer.

removeDate(): Promise<void>;

Returns

Promise<void>

removeFill()

Removes the slide background fill.

removeFill(): Promise<void>;

Returns

Promise<void>

removeFooter()

Removes this slide's footer.

removeFooter(): Promise<void>;

Returns

Promise<void>

removeSlideNumber()

Removes this slide's slide number.

removeSlideNumber(): Promise<void>;

Returns

Promise<void>

removeTransition()

Removes the transition effect.

removeTransition(): Promise<void>;

Returns

Promise<void>

replaceText(query, replacement, caseSensitive)

Finds the search text in this slide and replaces every match (replace all). Merged table cells, auto-updating fields such as slide number/date, and matches crossing paragraph boundaries are not changed. Matches in text that cannot be edited (e.g., collaboration locks) are skipped and reported via skippedCount.

replaceText(
query: string,
replacement?: string,
caseSensitive?: boolean
): Promise<{ replacedCount: number; skippedCount: number }>;

Parameters

NameTypeDescription
querystringText to find
replacement (optional)stringReplacement text. An empty string deletes the match (default: "")
caseSensitive (optional)booleanCase-sensitive (default: false)

Returns

Promise<{ replacedCount: number; skippedCount: number }> - Number of matches replaced / number of matches skipped

replyComment(commentProxy, text)

Adds a reply to a comment.

replyComment(commentProxy: Comment, text: string): Promise<Comment>;

Parameters

NameTypeDescription
commentProxyCommentParent comment
textstringReply text

Returns

Promise<Comment> - The created reply (null on failure)

resetBackground()

Resets the slide background.

resetBackground(): Promise<void>;

Returns

Promise<void>

resetLayout()

Resets the slide layout.

resetLayout(): Promise<void>;

Returns

Promise<void>

saveAsPicture(shapeProxyList)

Saves the slide's shapes as a single image. (Same as the existing UI behavior.)

saveAsPicture(shapeProxyList: (Shape | Image | Line | Group | Chart | Table | Diagram | OleObject | Control)[]): Promise<void>;

Parameters

NameTypeDescription
shapeProxyList(Shape | Image | Line | Group | Chart | Table | Diagram | OleObject | Control)[]Array of shape proxies to save as a picture

Returns

Promise<void>

setDate(date)

Sets this slide's date header/footer. (Created when absent, updated when present.)

setDate(date?: HeaderFooterDate): Promise<void>;

Parameters

NameTypeDescription
date (optional)HeaderFooterDateDate settings (default: auto-updating date)

Returns

Promise<void>

setFill(fill)

Applies a fill object returned by getBackgroundFill() straight to the slide background (symmetric with getBackgroundFill). Branches by type to call the matching setter. image reuses the readback's embed to restore within the same document; image input without embed is ignored (use setImageFill for new images).

setFill(fill: Fill): Promise<void>;

Parameters

NameTypeDescription
fillFillValue returned by getBackgroundFill()

Returns

Promise<void>

setFooter(text)

Sets this slide's footer. (Created when absent, updated when present.)

setFooter(text: string): Promise<void>;

Parameters

NameTypeDescription
textstringFooter text

Returns

Promise<void>

setGradientFill(type, stops, angle)

Sets the slide background to a gradient.

setGradientFill(
type?: GradientType,
stops?: { color: string; pos?: number; alpha?: number }[],
angle?: number
): Promise<void>;

Parameters

NameTypeDescription
type (optional)GradientTypeGradient type (lin/circle/rect/shape) (default: GradientType.LINEAR)
stops (optional){ color: string; pos?: number; alpha?: number }[]Color stops. Distributed evenly when pos is omitted; alpha is transparency (0–100) (default: [{ color: "accent1", pos: 0 }, { color: "bg1", pos: 100 }])
angle (optional)numberGradient angle (used only for lin) (default: 45)

Returns

Promise<void>

setImageFill(imageUrl, fillMode, alpha, detail)

Sets the slide background to an image.

setImageFill(
imageUrl: string,
fillMode?: ImageFillMode,
alpha?: number,
detail?: ImageFillDetail
): Promise<void>;

Parameters

NameTypeDescription
imageUrlstringImage URL
fillMode (optional)ImageFillModeImage fill mode (default: ImageFillMode.STRETCH)
alpha (optional)numberTransparency (0–100) (default: 0 (opaque))
detail (optional)ImageFillDetailDetail options. offset/scale/mirror/align apply only when fillMode = ImageFillMode.TILE (default: {})

Returns

Promise<void> - Resolves once the image is uploaded and applied as the background

setLayout(layoutType)

Applies a layout to the slide. When several layouts share the type, the first in master order is chosen.

setLayout(layoutType: SlideLayoutType): Promise<boolean>;

Parameters

NameTypeDescription
layoutTypeSlideLayoutTypeLayout type. Check the available types with doc.getLayoutList(slide)

Returns

Promise<boolean> - Whether it was applied (false if the type is not in this slide's master)

setPatternFill(preset, foreColor, backColor, foreAlpha, backAlpha)

Sets the slide background to a pattern (symmetric with the getBackgroundFill round trip - setFill's pattern path).

setPatternFill(
preset: PatternPreset,
foreColor?: string,
backColor?: string,
foreAlpha?: number,
backAlpha?: number
): Promise<void>;

Parameters

NameTypeDescription
presetPatternPresetPattern preset (apiConstants.PatternPreset)
foreColor (optional)stringForeground color hex (#RRGGBB) or scheme color (default: accent1 (theme accent 1))
backColor (optional)stringBackground color hex (#RRGGBB) or scheme color (default: bg1 (theme background 1))
foreAlpha (optional)numberForeground transparency (0–100) (default: 0 (opaque))
backAlpha (optional)numberBackground transparency (0–100) (default: 0 (opaque))

Returns

Promise<void>

setShowMasterShapes(show)

Sets whether the master (layout) background shapes are shown.

setShowMasterShapes(show: boolean): Promise<void>;

Parameters

NameTypeDescription
showbooleantrue: show master shapes, false: hide

Returns

Promise<void>

setSlideNoteText(text)

Sets the slide notes text. (Existing notes content is replaced.)

setSlideNoteText(text: string): Promise<void>;

Parameters

NameTypeDescription
textstringNote text

Returns

Promise<void>

setSlideNumber()

Shows the slide number on this slide.

setSlideNumber(): Promise<void>;

Returns

Promise<void>

setSolidFill(color, alpha)

Sets the slide background to a solid color.

setSolidFill(color: string, alpha?: number): Promise<void>;

Parameters

NameTypeDescription
colorstringhex (#RRGGBB) or scheme color
alpha (optional)numberTransparency (0–100) (default: 0 (opaque))

Returns

Promise<void>

setTransition(transition)

Sets the slide transition. Converts the flat input to the model format and applies it. Only options the effect supports are applied; values not given are filled from the default model. Remove effects with removeTransition(), not via type.

setTransition(transition: Transition): Promise<void>;

Parameters

NameTypeDescription
transitionTransitionTransition settings

Returns

Promise<void>

ungroupShapes(shapeProxy)

Ungroups a group into its child shapes. The separated children are recreated as new shapes, so child proxies taken before ungrouping are no longer valid. The separated shapes come back as the return value.

ungroupShapes(shapeProxy: Group): Promise<Shape[]>;

Parameters

NameTypeDescription
shapeProxyGroupGroup shape proxy to ungroup

Returns

Promise<Shape[]> - Array of the separated child shapes