跳到主要内容

GetClassType

返回 ApiRun 类的类型。

语法

expression.GetClassType();

expression - 表示 ApiRun 类(文本块)的变量。

参数

此方法没有任何参数。

返回值

"run"

示例

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

// How to get a class type of ApiRun.

// Retrieve class type of ApiRun object and insert it to the document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let run = Api.CreateRun();
run.AddText("This is just a sample text. Nothing special.");
paragraph.AddElement(run);
let classType = run.GetClassType();
paragraph = Api.CreateParagraph();
paragraph.AddText("Class Type = " + classType);
doc.Push(paragraph);