PowerPoint.InsertSlideOptions interface
Represents the available options when inserting slides.
Remarks
[ API set: PowerPointApi 1.2 ]
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/slide-management/insert-slides.yaml
await PowerPoint.run(async function(context) {
// Get the ID of the first selected slide.
const presentation: PowerPoint.Presentation = context.presentation;
const selected: PowerPoint.Slide = presentation.getSelectedSlides().getItemAt(0);
selected.load("id");
await context.sync();
// Insert the other presentation after the selected slide.
const insertOptions: PowerPoint.InsertSlideOptions = {
formatting: PowerPoint.InsertSlideFormatting.useDestinationTheme,
targetSlideId: selected.id
};
presentation.insertSlidesFromBase64(chosenFileBase64, insertOptions);
await context.sync();
});
Properties
formatting | Specifies which formatting to use during slide insertion. The default option is to use "KeepSourceFormatting". |
source |
Specifies the slides from the source presentation that will be inserted into the current presentation. These slides are represented by their IDs which can be retrieved from a |
target |
Specifies where in the presentation the new slides will be inserted. The new slides will be inserted after the slide with the given slide ID. If |
Property Details
formatting
Specifies which formatting to use during slide insertion. The default option is to use "KeepSourceFormatting".
formatting?: PowerPoint.InsertSlideFormatting | "KeepSourceFormatting" | "UseDestinationTheme";
Property Value
PowerPoint.InsertSlideFormatting | "KeepSourceFormatting" | "UseDestinationTheme"
Remarks
sourceSlideIds
Specifies the slides from the source presentation that will be inserted into the current presentation. These slides are represented by their IDs which can be retrieved from a Slide
object. The order of these slides is preserved during the insertion. If any of the source slides are not found, or if the IDs are invalid, the operation throws a SlideNotFound
exception and no slides will be inserted. All of the source slides will be inserted when sourceSlideIds
is not provided (this is the default behavior).
sourceSlideIds?: string[];
Property Value
string[]
Remarks
targetSlideId
Specifies where in the presentation the new slides will be inserted. The new slides will be inserted after the slide with the given slide ID. If targetSlideId
is not provided, the slides will be inserted at the beginning of the presentation. If targetSlideId
is invalid or if it is pointing to a non-existing slide, the operation throws a SlideNotFound
exception and no slides will be inserted.
targetSlideId?: string;
Property Value
string
Remarks
Office Add-ins