跳到主要内容

ApplyLayout

将指定版式应用于当前幻灯片。 版式必须位于幻灯片母版中。

语法

expression.ApplyLayout(oLayout);

expression - 表示 ApiSlide 类的变量。

参数

名称必需/可选数据类型默认值描述
oLayout必需ApiLayout要应用的版式。

返回值

boolean

示例

此示例将指定版式应用于幻灯片。版式必须位于幻灯片母版中。

// How to apply a layout to the slide.

// Get a layout from the presentation master using its index and apply it to the slide.

const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
const master = presentation.GetMaster(0);
const layout = master.GetLayout(4);
slide.ApplyLayout(layout);