PowerPoint.InsertSlideOptions interface

表示插入幻灯片时的可用选项。

注解

API 集:PowerPointApi 1.2

使用方

示例

// 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();
});

属性

formatting

指定在幻灯片插入期间要使用的格式。 默认选项是使用“KeepSourceFormatting”。

sourceSlideIds

指定将插入当前演示文稿的源演示文稿中的幻灯片。 这些幻灯片由可从对象检索 Slide 的 ID 表示。 插入过程中保留这些幻灯片的顺序。 如果未找到任何源幻灯片或 ID 无效,则操作将 SlideNotFound 引发异常,并且不会插入任何幻灯片。 未提供源 sourceSlideIds 幻灯片时将插入所有源幻灯片 (这是默认行为) 。

targetSlideId

指定新幻灯片在演示文稿中的哪个位置插入。 新幻灯片将插入到具有给定幻灯片 ID 的幻灯片之后。 如果未提供,幻 targetSlideId 灯片将插在演示文稿的开头。 如果无效或指向不存在的幻灯片,则 targetSlideId 操作将 SlideNotFound 引发异常,并且不会插入任何幻灯片。

属性详细信息

formatting

指定在幻灯片插入期间要使用的格式。 默认选项是使用“KeepSourceFormatting”。

formatting?: PowerPoint.InsertSlideFormatting | "KeepSourceFormatting" | "UseDestinationTheme";

属性值

PowerPoint.InsertSlideFormatting | "KeepSourceFormatting" | "UseDestinationTheme"

注解

API 集:PowerPointApi 1.2

sourceSlideIds

指定将插入当前演示文稿的源演示文稿中的幻灯片。 这些幻灯片由可从对象检索 Slide 的 ID 表示。 插入过程中保留这些幻灯片的顺序。 如果未找到任何源幻灯片或 ID 无效,则操作将 SlideNotFound 引发异常,并且不会插入任何幻灯片。 未提供源 sourceSlideIds 幻灯片时将插入所有源幻灯片 (这是默认行为) 。

sourceSlideIds?: string[];

属性值

string[]

注解

API 集:PowerPointApi 1.2

targetSlideId

指定新幻灯片在演示文稿中的哪个位置插入。 新幻灯片将插入到具有给定幻灯片 ID 的幻灯片之后。 如果未提供,幻 targetSlideId 灯片将插在演示文稿的开头。 如果无效或指向不存在的幻灯片,则 targetSlideId 操作将 SlideNotFound 引发异常,并且不会插入任何幻灯片。

targetSlideId?: string;

属性值

string

注解

API 集:PowerPointApi 1.2