GetLayoutsCount
Returns a number of layout objects.
Syntax
expression.GetLayoutsCount();
expression
- A variable that represents a ApiMaster class.
Parameters
This method doesn't have any parameters.
Returns
number
Example
This example gets a number of layout objects and insert it itno the presentation.
- Code
- Result
// How to get a master layout count knowing its index.
// Count each layout from the master.
const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
slide.RemoveAllObjects();
const master = presentation.GetMaster(0);
const layoutsCount = master.GetLayoutsCount();
const fill = Api.CreateSolidFill(Api.CreateRGBColor(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);
shape.SetSize(300 * 36000, 130 * 36000);
const docContent = shape.GetDocContent();
const paragraph = docContent.GetElement(0);
paragraph.SetJc("left");
paragraph.AddText("Number of layouts = " + layoutsCount);
slide.AddObject(shape);