SetName
Sets a name to the current layout.
Syntax
expression.SetName(sName);
expression
- A variable that represents a ApiLayout class.
Parameters
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
sName | Required | string | Layout name to be set. |
Returns
boolean
Example
This example sets a name to the current layout.
- Code
- Result
// How to set name for a layout.
// Rename a slide layout.
const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
slide.RemoveAllObjects();
const master = presentation.GetMaster(0);
const layout = master.GetLayout(0);
layout.SetName("New layout");
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("A new name was set to the current layout.");
layout.AddObject(shape);