Skip to main content

Show.Document

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

Remarks​

  • Module: Presentation · Office.show(iframe) · namespace Show
  • Obtained from: app.getDocument() (root handle) on the app handle returned by Office.show(iframe). Document methods live on this handle, not on the app handle.
  • Every method returns a Promise; signatures use TypeScript notation.

Methods​

MethodDescription
createColorScheme(colorScheme)Creates a custom color theme and applies it to the current document.
deleteSlide(slideProxy)Deletes one slide.
deleteSlides(slideProxyList)Deletes multiple slides at once.
duplicateSlide(slideProxy)Duplicates one slide.
duplicateSlides(slideProxyList)Duplicates multiple slides at once.
findCharts(slides, filter)Searches charts matching the criteria across multiple slides.
findComments(slides, filter)Searches comments matching the criteria across multiple slides.
findShapes(slides, filter)Searches shapes matching the criteria across multiple slides.
findSlides(filter)Searches for slides matching the criteria.
findTables(slides, filter)Searches tables matching the criteria across multiple slides.
findText(query, slideProxyList, caseSensitive)Searches for text.
getChartStyleList()Returns the series color palette for each chart preset style (1–12), based on the theme applied to the current slide.
getColorScheme()Returns the color theme of the document (symmetric with setColorScheme).
getColorSchemeList()Returns the list of applicable color themes (built-in + custom).
getCurrentSlide()Returns the slide in the current view.
getDocumentInfo()Returns document (canvas) info.
getFontScheme()Returns the theme fonts of the document (symmetric with setFontScheme).
getFontSchemeList()Returns the list of applicable theme fonts (built-in + custom).
getFormatScheme()Returns the theme effects of the document (symmetric with setFormatScheme).
getFormatSchemeList()Returns the list of applicable theme effects.
getLayoutList(slideProxy)Returns the layout list of the master the given slide belongs to.
getSlide(index)Gets a slide by index.
getSlideCount()-
getSlideIndex(slideProxy)Finds a slide's 0-based index.
getSlides()Returns all slides of the document in order.
getSlideSize()Slide area size (px).
getTableStyleNames()Returns the applicable table style names.
goToSlide(slideProxy)Switches the current view to the given slide.
hideSlides(slideProxyList, isHidden)Changes the hidden state of multiple slides at once.
insertSlide(index, layoutType)Inserts a new slide.
isCommentsVisible()Returns whether comments are shown for the whole document (symmetric with showComments).
moveSlide(fromIndex, toIndex)Moves a slide to another position.
removeDate()Removes the date header/footer from all slides.
removeFooter()Removes the footer from all slides.
removeSlideNumber()Removes the slide number from all slides.
removeTransition(slideProxyList)Removes the transition effect from multiple slides.
replaceText(query, replacement, slideProxyList, caseSensitive)Finds the search text and replaces every match with the new text (Replace All).
resetBackgrounds(slideProxyList)Resets the background of multiple slides at once.
selectAll(scope)Selects all of the given range.
setColorScheme(colorSchemePrst)Changes the document-wide color theme.
setDate(date)Sets the date header/footer on all slides.
setFontScheme(fontSchemePrst)Changes the document's theme fonts.
setFooter(text)Sets the footer on all slides.
setFormatScheme(formatSchemePrst)Changes the theme effects of the document.
setSlideColorScheme(slideProxyList, colorSchemePrst)Applies a color theme to the given slides only.
setSlideNumber()Shows the slide number on all slides.
setTransition(slideProxyList, transition)Applies a transition effect to multiple slides at once.
setViewMode(mode)Changes the editing view's zoom/fit.
showComments(show)Sets comment visibility for the whole document.
startSlideShow(fromCurrent)Starts the slide show (full-screen presentation).
uploadImageFromUrl(url)Uploads an image (URL / data:URI) to the server file DB.

Method details​

createColorScheme(colorScheme)​

Creates a custom color theme and applies it to the current document.

createColorScheme(colorScheme: ColorScheme): Promise<void>;

Parameters

NameTypeDescription
colorSchemeColorSchemeNew color scheme information

Returns

none

deleteSlide(slideProxy)​

Deletes one slide.

deleteSlide(slideProxy: Slide): Promise<void>;

Parameters

NameTypeDescription
slideProxySlideSlide to delete

Returns

none

deleteSlides(slideProxyList)​

Deletes multiple slides at once.

deleteSlides(slideProxyList: Slide[]): Promise<void>;

Parameters

NameTypeDescription
slideProxyListSlide[]Array of slides to delete

Returns

none

duplicateSlide(slideProxy)​

Duplicates one slide.

duplicateSlide(slideProxy: Slide): Promise<Slide>;

Parameters

NameTypeDescription
slideProxySlideSlide to duplicate

Returns

Promise<Slide> - The duplicated slide proxy

duplicateSlides(slideProxyList)​

Duplicates multiple slides at once.

duplicateSlides(slideProxyList: Slide[]): Promise<Slide[]>;

Parameters

NameTypeDescription
slideProxyListSlide[]Array of slides to duplicate

Returns

Promise<Slide[]> - Array of duplicated slide proxies

findCharts(slides, filter)​

Searches charts matching the criteria across multiple slides.

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

Parameters

NameTypeDescription
slidesSlide[]Slides to search
filter (optional)ChartFilterSearch criteria (same as Slide.findCharts) (default: all charts)

Returns

Promise<Chart[]> - List of matching charts

findComments(slides, filter)​

Searches comments matching the criteria across multiple slides.

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

Parameters

NameTypeDescription
slidesSlide[]Slides to search
filter (optional)CommentFilterSearch criteria (same as Slide.findComments) (default: all comments)

Returns

Promise<Comment[]> - List of matching comments

findShapes(slides, filter)​

Searches shapes matching the criteria across multiple slides. Per-slide search equals Slide.findShapes; results are concatenated in slide order.

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

Parameters

NameTypeDescription
slidesSlide[]Slides to search
filter (optional)ShapeFilterSearch criteria (same as Slide.findShapes) (default: all shapes)

Returns

Promise<Shape[]> - List of matching shapes

findSlides(filter)​

Searches for slides matching the criteria.

findSlides(filter?: SlideFilter): Promise<Slide[]>;

Parameters

NameTypeDescription
filter (optional)SlideFilterSearch criteria (default: all slides)

Returns

Promise<Slide[]> - List of matching slides

findTables(slides, filter)​

Searches tables matching the criteria across multiple slides.

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

Parameters

NameTypeDescription
slidesSlide[]Slides to search
filter (optional)TableFilterSearch criteria (same as Slide.findTables) (default: all tables)

Returns

Promise<Table[]> - List of matching tables

findText(query, slideProxyList, caseSensitive)​

Searches for text. If slideProxyList is given, only those slides are searched. Matches are returned in document order (slide → shape → table cell). Table cells hidden by merging, auto-updating fields such as slide numbers and dates, and matches that cross a paragraph boundary are not found. Matches in speaker notes are not returned (read note text with Slide.getSlideNoteText).

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

Parameters

NameTypeDescription
querystringText to find (line breaks not allowed)
slideProxyList (optional)Slide[]Slides to search. An empty array searches nothing (default: all slides)
caseSensitive (optional)booleanCase-sensitive (default: false)

Returns

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

getChartStyleList()​

Returns the series color palette for each chart preset style (1–12), based on the theme applied to the current slide. Useful for choosing the style for Chart.setStyle. A style is a combination of a color group (4) × a background/line variant (3). Colors are determined by the group alone, so styles in the same group (for example 1–3) share the same colors, and the difference within a group (the trailing 1/2/3) is the background/line variant. Colors depend on the theme accents, so they change when the theme changes.

getChartStyleList(): Promise<{ style: number; colors: string[]; variant: string }[]>;

Returns

Promise<{ style: number; colors: string[]; variant: string }[]> - chart style list; an empty array when the document has no slides

getColorScheme()​

Returns the color theme of the document (symmetric with setColorScheme). It is the theme of the master the current slide belongs to and does not include per-slide overrides given with setSlideColorScheme. Use slide.getColorScheme() to read a single slide.

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

Returns

Promise<{ prst: string | null; name: string; colors: Record<string, string> } | null> - color theme (prst: filled only when the theme is one listed by getColorSchemeList, null for a document-specific theme read from the file; name: theme name; colors: slot name to #RRGGBB). null when the document has no slides

getColorSchemeList()​

Returns the list of applicable color themes (built-in + custom).

getColorSchemeList(): Promise<{ prst: string; name: string; colors: Record<string, string> }[]>;

Returns

Promise<{ prst: string; name: string; colors: Record<string, string> }[]> - List of color schemes (prst: preset name, name: display name, colors: slot name → #RRGGBB)

getCurrentSlide()​

Returns the slide in the current view.

getCurrentSlide(): Promise<Slide>;

Returns

Promise<Slide> - current slide (null when the document has no slides)

getDocumentInfo()​

Returns document (canvas) info.

getDocumentInfo(): Promise<{ width: number; height: number; slideCount: number }>;

Returns

Promise<{ width: number; height: number; slideCount: number }> - Width and height of the slide area (px) and the total slide count

getFontScheme()​

Returns the theme fonts of the document (symmetric with setFontScheme).

getFontScheme(): Promise<{ prst: string | null; name: string } | null>;

Returns

Promise<{ prst: string | null; name: string } | null> - current theme fonts (prst: filled only when the theme is one listed by getFontSchemeList, null for a document-specific theme that is not in the list; name: theme name). null when the document has no slides

getFontSchemeList()​

Returns the list of applicable theme fonts (built-in + custom).

getFontSchemeList(): Promise<{ prst: string; name: string }[]>;

Returns

Promise<{ prst: string; name: string }[]> - List of theme fonts (prst: preset name, name: display name)

getFormatScheme()​

Returns the theme effects of the document (symmetric with setFormatScheme).

getFormatScheme(): Promise<{ prst: string | null; name: string } | null>;

Returns

Promise<{ prst: string | null; name: string } | null> - current theme effects (prst: filled only when the theme is one listed by getFormatSchemeList; name: display name, or the theme's original name when it is not in the list). null when the document has no slides

getFormatSchemeList()​

Returns the list of applicable theme effects.

getFormatSchemeList(): Promise<{ prst: string; name: string }[]>;

Returns

Promise<{ prst: string; name: string }[]> - List of theme effects (prst: preset name, name: display name)

getLayoutList(slideProxy)​

Returns the layout list of the master the given slide belongs to. Layouts are a master-level concept, so they are queried at the document level.

getLayoutList(slideProxy: Slide): Promise<{ name: string; type: SlideLayoutType }[]>;

Parameters

NameTypeDescription
slideProxySlideTarget slide

Returns

Promise<{ name: string; type: SlideLayoutType }[]> - layout list (an empty array when there is no target slide)

getSlide(index)​

Gets a slide by index.

getSlide(index: number): Promise<Slide>;

Parameters

NameTypeDescription
indexnumber0-based

Returns

Promise<Slide> - The slide (null if out of range)

getSlideCount()​

getSlideCount(): Promise<number>;

Returns

Promise<number> - Total number of slides in the document

getSlideIndex(slideProxy)​

Finds a slide's 0-based index.

getSlideIndex(slideProxy: Slide): Promise<number>;

Parameters

NameTypeDescription
slideProxySlideTarget slide

Returns

Promise<number> - -1 for a slide that is not in the document

getSlides()​

Returns all slides of the document in order.

getSlides(): Promise<Slide[]>;

Returns

Promise<Slide[]> - List of slides

getSlideSize()​

Slide area size (px). A single value shared by every slide in the document.

getSlideSize(): Promise<{ width: number; height: number }>;

Returns

Promise<{ width: number; height: number }> - Width and height of the slide area (px)

getTableStyleNames()​

Returns the applicable table style names. Pass a name from here directly to slide.insertTable / table.setStyle.

getTableStyleNames(): Promise<string[]>;

Returns

Promise<string[]> - List of table style names (same as the editor's 'Table Styles' gallery)

goToSlide(slideProxy)​

Switches the current view to the given slide.

goToSlide(slideProxy: Slide): Promise<void>;

Parameters

NameTypeDescription
slideProxySlideSlide to go to

Returns

none

hideSlides(slideProxyList, isHidden)​

Changes the hidden state of multiple slides at once.

hideSlides(slideProxyList: Slide[], isHidden: boolean): Promise<void>;

Parameters

NameTypeDescription
slideProxyListSlide[]Array of target slides
isHiddenbooleantrue: hide, false: show

Returns

none

insertSlide(index, layoutType)​

Inserts a new slide.

insertSlide(index?: number, layoutType?: SlideLayoutType): Promise<Slide>;

Parameters

NameTypeDescription
index (optional)numberInsert position (0-based) (default: appended at the end)
layoutType (optional)SlideLayoutTypeLayout type. If several layouts share the type, the first one is used. If the type does not exist, BLANK is used (or the first layout of the first master when the document has no BLANK) (default: SlideLayoutType.BLANK)

Returns

Promise<Slide> - The inserted slide

isCommentsVisible()​

Returns whether comments are shown for the whole document (symmetric with showComments).

isCommentsVisible(): Promise<boolean>;

Returns

Promise<boolean> - true when comments are shown

moveSlide(fromIndex, toIndex)​

Moves a slide to another position.

moveSlide(fromIndex: number, toIndex: number): Promise<void>;

Parameters

NameTypeDescription
fromIndexnumberSource index (0-based)
toIndexnumberDestination index (0-based)

Returns

none

removeDate()​

Removes the date header/footer from all slides.

removeDate(): Promise<void>;

Returns

none

removeFooter()​

Removes the footer from all slides.

removeFooter(): Promise<void>;

Returns

none

removeSlideNumber()​

Removes the slide number from all slides.

removeSlideNumber(): Promise<void>;

Returns

none

removeTransition(slideProxyList)​

Removes the transition effect from multiple slides. (Handled as a single undo.)

removeTransition(slideProxyList: Slide[]): Promise<void>;

Parameters

NameTypeDescription
slideProxyListSlide[]Array of target slides

Returns

none

replaceText(query, replacement, slideProxyList, caseSensitive)​

Finds the search text and replaces every match with the new text (Replace All). If slideProxyList is given, only those slides are changed. Unlike findText, text in speaker notes is also replaced and counted in replacedCount. Table cells hidden by merging, auto-updating fields such as slide numbers and dates, and matches that cross a paragraph boundary are not changed. Matches in text that cannot be edited, for example because of a collaboration lock, are left unchanged and reported in skippedCount.

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

Parameters

NameTypeDescription
querystringText to find (line breaks not allowed)
replacement (optional)stringReplacement text. An empty string deletes the match (default: "")
slideProxyList (optional)Slide[]Slides to replace in. An empty array changes nothing (default: all slides)
caseSensitive (optional)booleanCase-sensitive (default: false)

Returns

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

resetBackgrounds(slideProxyList)​

Resets the background of multiple slides at once.

resetBackgrounds(slideProxyList: Slide[]): Promise<void>;

Parameters

NameTypeDescription
slideProxyListSlide[]Array of target slides

Returns

none

selectAll(scope)​

Selects all of the given range.

selectAll(scope?: SelectScope): Promise<boolean>;

Parameters

NameTypeDescription
scope (optional)SelectScope"shape": every shape on the current slide
"slide": every slide
"text": all of the text being edited (selects nothing when not editing text) (default: SelectScope.SHAPE)

Returns

Promise<boolean> - false if there is nothing to select

setColorScheme(colorSchemePrst)​

Changes the document-wide color theme. Check the list with getColorSchemeList, then pass prst.

setColorScheme(colorSchemePrst: string): Promise<void>;

Parameters

NameTypeDescription
colorSchemePrststringColor scheme preset name

Returns

none

setDate(date)​

Sets the date header/footer on all slides. (Created when absent, updated when present.)

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

Parameters

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

Returns

none

setFontScheme(fontSchemePrst)​

Changes the document's theme fonts. Check the list with getFontSchemeList, then pass prst.

setFontScheme(fontSchemePrst: string): Promise<void>;

Parameters

NameTypeDescription
fontSchemePrststringTheme font preset name

Returns

none

setFooter(text)​

Sets the footer on all slides. (Created when absent, updated when present.)

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

Parameters

NameTypeDescription
textstringFooter text

Returns

none

setFormatScheme(formatSchemePrst)​

Changes the theme effects of the document. Check the list with getFormatSchemeList and pass prst.

setFormatScheme(formatSchemePrst: string): Promise<void>;

Parameters

NameTypeDescription
formatSchemePrststringTheme effect preset name

Returns

none

setSlideColorScheme(slideProxyList, colorSchemePrst)​

Applies a color theme to the given slides only. Changing the whole-document theme with setColorScheme afterwards releases every per-slide override given here. Check the list with getColorSchemeList and pass prst.

setSlideColorScheme(slideProxyList: Slide[], colorSchemePrst: string): Promise<void>;

Parameters

NameTypeDescription
slideProxyListSlide[]Array of target slides
colorSchemePrststringColor scheme preset name

Returns

none

setSlideNumber()​

Shows the slide number on all slides.

setSlideNumber(): Promise<void>;

Returns

none

setTransition(slideProxyList, transition)​

Applies a transition effect to multiple slides at once. (Handled as a single undo.) Only options the effect supports are applied; values not given are filled from the default model. Remove effects with removeTransition(), not via type.

setTransition(slideProxyList: Slide[], transition: Transition): Promise<void>;

Parameters

NameTypeDescription
slideProxyListSlide[]Array of target slides (pass getSlides() to apply to all)
transitionTransitionTransition settings

Returns

none

setViewMode(mode)​

Changes the editing view's zoom/fit.

setViewMode(mode: ViewMode): Promise<void>;

Parameters

NameTypeDescription
modeViewModeView zoom or fit-to-window. Only the 8 ViewMode values are allowed.

Returns

none

showComments(show)​

Sets comment visibility for the whole document.

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

Parameters

NameTypeDescription
showbooleantrue: show comments, false: hide comments

Returns

none

startSlideShow(fromCurrent)​

Starts the slide show (full-screen presentation).

startSlideShow(fromCurrent?: boolean): Promise<void>;

Parameters

NameTypeDescription
fromCurrent (optional)booleantrue: start from the current slide, false: start from the beginning (default: false)

Returns

none

uploadImageFromUrl(url)​

Uploads an image (URL / data:URI) to the server file DB. (Image handling for SVG import.) Upload resolution is shared via ApiUtils.uploadImageLink (shared by shape/background setImageFill·htmlImport).

uploadImageFromUrl(url: string): Promise<{isError?:boolean, src?:string, width?:number, height?:number}>;

Parameters

NameTypeDescription
urlstringImage URL or data URI

Returns

Promise<{isError?:boolean, src?:string, width?:number, height?:number}> - on success, resolves with the loader's imgFileInfo as it is (src/width/height, no isError); on failure, resolves with { isError: true }