跳到主要内容

GetClassType

返回 ApiShape 类的类型。

语法

expression.GetClassType();

expression - 表示 ApiShape 类的变量。

参数

此方法没有任何参数。

返回值

"shape"

示例

获取文档中形状的类类型。

// How to identify the class type of a shape in a document?

// Obtain the class type identifier of a shape object in a document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let fill = Api.CreateSolidFill(Api.RGB(255, 111, 61));
let stroke = Api.CreateStroke(0, Api.CreateNoFill());
let drawing = Api.CreateShape("rect", 3212465, 963295, fill, stroke);
paragraph.AddDrawing(drawing);
let docContent = drawing.GetContent();
let classType = drawing.GetClassType();
paragraph = Api.CreateParagraph();
paragraph.AddText("Class Type = " + classType);
docContent.AddElement(0, paragraph);