跳到主要内容

GetClassType

返回 ApiDocumentContent 类的类型。

语法

expression.GetClassType();

expression - 表示 ApiDocumentContent 类的变量。

参数

此方法没有任何参数。

返回值

"documentContent"

示例

此示例获取类类型并将其插入到文档中。

// How get a class type of ApiDocumentContent.

// Retrieve class type of a created document content and display it.

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.GetDocContent();
docContent.RemoveAllElements();
paragraph = Api.CreateParagraph();
paragraph.SetJc("left");
paragraph.AddText("We removed all elements from the shape and added a new paragraph inside it.");
docContent.AddElement(0, paragraph);
let classType = docContent.GetClassType();
paragraph = Api.CreateParagraph();
paragraph.AddText("Class Type = " + classType);
doc.Push(paragraph);