跳到主要内容

GetSlideByIndex

按位置返回演示文稿中的幻灯片。

语法

expression.GetSlideByIndex(nIndex);

expression - 表示 ApiPresentation 类的变量。

参数

名称必需/可选数据类型默认值描述
nIndex必需number演示文稿中的幻灯片编号(位置)。

返回值

ApiSlide

示例

此示例演示如何按位置获取演示文稿中的幻灯片。

// How to find a slide from the presentation using its index.

// Get slide from the presentation by its index.

const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
slide.RemoveAllObjects();

const fill = Api.CreateSolidFill(Api.RGB(255, 111, 61));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape("flowChartMagneticTape", 300 * 36000, 130 * 36000, fill, stroke);
shape.SetPosition(608400, 1267200);
slide.AddObject(shape);