PowerPoint.AddSlideOptions interface

Represents the available options when adding a new slide.

Remarks

[ API set: PowerPointApi 1.3 ]

Examples

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

const chosenMaster = $("#master-id").val() as string;
const chosenLayout = $("#layout-id").val() as string;

await PowerPoint.run(async function(context) {
  // Create a new slide using an existing master slide and layout.
  const newSlideOptions: PowerPoint.AddSlideOptions = {
    slideMasterId: chosenMaster, /* An ID from `Presentation.slideMasters`. */
    layoutId: chosenLayout /* An ID from `SlideMaster.layouts`. */
  };
  context.presentation.slides.add(newSlideOptions);
  await context.sync();
});

Properties

layoutId

Specifies the ID of a Slide Layout to be used for the new slide. If no layoutId is provided, but a slideMasterId is provided, then the ID of the first layout from the specified Slide Master will be used. If no slideMasterId is provided, but a layoutId is provided, then the specified layout needs to be available for the default Slide Master (as specified in the slideMasterId description). Otherwise, an error will be thrown.

slideMasterId

Specifies the ID of a Slide Master to be used for the new slide. If no slideMasterId is provided, then the previous slide's Slide Master will be used. If there is no previous slide, then the presentation's first Slide Master will be used.

Property Details

layoutId

Specifies the ID of a Slide Layout to be used for the new slide. If no layoutId is provided, but a slideMasterId is provided, then the ID of the first layout from the specified Slide Master will be used. If no slideMasterId is provided, but a layoutId is provided, then the specified layout needs to be available for the default Slide Master (as specified in the slideMasterId description). Otherwise, an error will be thrown.

layoutId?: string;

Property Value

string

Remarks

[ API set: PowerPointApi 1.3 ]

slideMasterId

Specifies the ID of a Slide Master to be used for the new slide. If no slideMasterId is provided, then the previous slide's Slide Master will be used. If there is no previous slide, then the presentation's first Slide Master will be used.

slideMasterId?: string;

Property Value

string

Remarks

[ API set: PowerPointApi 1.3 ]