跳到主要内容

CreatePlaceholder

Creates a new placeholder.

Syntax

expression.CreatePlaceholder(sType);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sTypeRequiredstringThe placeholder type ("body", "chart", "clipArt", "ctrTitle", "diagram", "date", "footer", "header", "media", "object", "picture", "sldImage", "sldNumber", "subTitle", "table", "title").

Returns

ApiPlaceholder

Example

This example shows how to create placeholder for shape.

// How to change a placeholder type of an object.

// Add a placeholder to the shape.

const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
slide.RemoveAllObjects();

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 placeholder = Api.CreatePlaceholder("picture");
shape.SetPlaceholder(placeholder);
slide.AddObject(shape);