跳到主要内容

AddSlide

在演示文稿末尾追加新幻灯片。

语法

expression.AddSlide(oSlide, nIndex);

expression - 表示 ApiPresentation 类的变量。

参数

名称必需/可选数据类型默认值描述
oSlide必需ApiSlide使用 Api#CreateSlide 方法创建的幻灯片。
nIndex必需number要添加的幻灯片的索引。如果未指定,幻灯片将添加到演示文稿末尾。

返回值

此方法不返回任何数据。

示例

此示例在演示文稿末尾追加新幻灯片。

// How to add a new slide to the presentation.

// Create a slide and add it to the end of presentation.

const presentation = Api.GetPresentation();
const slide = Api.CreateSlide();
const gs1 = Api.CreateGradientStop(Api.RGB(255, 213, 191), 0);
const gs2 = Api.CreateGradientStop(Api.RGB(255, 111, 61), 100000);
const fill = Api.CreateRadialGradientFill([gs1, gs2]);
slide.SetBackground(fill);
presentation.AddSlide(slide);