跳到主要内容

ApplyLayout

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

语法

expression.ApplyLayout(oLayout);

expression - 表示 ApiSlide 类的变量。

参数

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

返回值

boolean

示例

将幻灯片母版中的预定义布局应用于当前幻灯片。

// Retrieve the master slide and select a specific layout by index.

// Set the layout to the slide using the master's layout definition.

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