GetLayoutType
返回当前版式的类型。
语法
expression.GetLayoutType();
expression - 表示 ApiLayout 类的变量。
参数
此方法没有任何参数。
返回值
示例
返回演示文稿中版式的类型。
// How to get the layout type for a layout in a presentation?
// Get the layout type and display the result in a presentation.
const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
const master = presentation.GetMaster(0);
const layouts = master.GetAllLayouts();
const fill = Api.CreateSolidFill(Api.HexColor('#33bbaa'));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape('rect', Api.MillimetersToEmus(300), Api.MillimetersToEmus(130), fill, stroke);
slide.AddObject(shape);
const docContent = shape.GetContent();
const paragraph = docContent.GetElement(0);
paragraph.AddText('Found layouts with types:\n');
paragraph.AddText(
layouts
.map(layout => layout.GetLayoutType())
.join(', ')
);