PowerPoint.Slide class

Represents a single slide of a presentation.

Extends

Remarks

[ API set: PowerPointApi 1.2 ]

Properties

context

The request context associated with the object. This connects the add-in's process to the Office host application's process.

id

Gets the unique ID of the slide.

layout

Gets the layout of the slide.

shapes

Returns a collection of shapes in the slide.

slideMaster

Gets the SlideMaster object that represents the slide's default content.

tags

Returns a collection of tags in the slide.

Methods

delete()

Deletes the slide from the presentation. Does nothing if the slide does not exist.

load(options)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNames)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNamesAndPaths)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

toJSON()

Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify, in turn, calls the toJSON method of the object that is passed to it.) Whereas the original PowerPoint.Slide object is an API object, the toJSON method returns a plain JavaScript object (typed as PowerPoint.Interfaces.SlideData) that contains shallow copies of any loaded child properties from the original object.

Property Details

context

The request context associated with the object. This connects the add-in's process to the Office host application's process.

context: RequestContext;

Property Value

id

Gets the unique ID of the slide.

readonly id: string;

Property Value

string

Remarks

[ API set: PowerPointApi 1.2 ]

layout

Gets the layout of the slide.

readonly layout: PowerPoint.SlideLayout;

Property Value

Remarks

[ API set: PowerPointApi 1.3 ]

shapes

Returns a collection of shapes in the slide.

readonly shapes: PowerPoint.ShapeCollection;

Property Value

Remarks

[ API set: PowerPointApi 1.3 ]

slideMaster

Gets the SlideMaster object that represents the slide's default content.

readonly slideMaster: PowerPoint.SlideMaster;

Property Value

Remarks

[ API set: PowerPointApi 1.3 ]

tags

Returns a collection of tags in the slide.

readonly tags: PowerPoint.TagCollection;

Property Value

Remarks

[ API set: PowerPointApi 1.3 ]

Method Details

delete()

Deletes the slide from the presentation. Does nothing if the slide does not exist.

delete(): void;

Returns

void

Remarks

[ API set: PowerPointApi 1.2 ]

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/slide-management/get-set-slides.yaml

// Deletes the selected slides.
await PowerPoint.run(async (context) => {
  context.presentation.load("slides");
  await context.sync();
  const slides = context.presentation.getSelectedSlides();
  const slideCount = slides.getCount();
  slides.load("items");
  await context.sync();
  slides.items.map((slide) => {
    slide.delete();
  });
});

load(options)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(options?: PowerPoint.Interfaces.SlideLoadOptions): PowerPoint.Slide;

Parameters

options
PowerPoint.Interfaces.SlideLoadOptions

Provides options for which properties of the object to load.

Returns

load(propertyNames)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNames?: string | string[]): PowerPoint.Slide;

Parameters

propertyNames

string | string[]

A comma-delimited string or an array of strings that specify the properties to load.

Returns

load(propertyNamesAndPaths)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNamesAndPaths?: {
            select?: string;
            expand?: string;
        }): PowerPoint.Slide;

Parameters

propertyNamesAndPaths

{ select?: string; expand?: string; }

propertyNamesAndPaths.select is a comma-delimited string that specifies the properties to load, and propertyNamesAndPaths.expand is a comma-delimited string that specifies the navigation properties to load.

Returns

toJSON()

Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify, in turn, calls the toJSON method of the object that is passed to it.) Whereas the original PowerPoint.Slide object is an API object, the toJSON method returns a plain JavaScript object (typed as PowerPoint.Interfaces.SlideData) that contains shallow copies of any loaded child properties from the original object.

toJSON(): PowerPoint.Interfaces.SlideData;

Returns