跳到主要内容

GetClassType

返回 ApiRun 类的类型。

语法

expression.GetClassType();

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

参数

此方法没有任何参数。

返回值

"run"

示例

识别文档中文本运行的对象类型。

// How do I find out what kind of object a text run is in a document?

// Confirm the category a text run belongs to in a 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);