跳到主要内容

GetClassType

返回 ApiHyperlink 类的类型。

语法

expression.GetClassType();

expression - 表示 ApiHyperlink 类的变量。

参数

此方法没有任何参数。

返回值

"hyperlink"

示例

读取文档中超链接对象的类类型。

// How do I identify the type of a hyperlink element in a document?

// Verify that a hyperlink returns the correct class type label when queried in a document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let run = Api.CreateRun();
run.AddText("ONLYOFFICE Document Builder");
paragraph.AddElement(run);
let hyperlink = paragraph.AddHyperlink("https://api.onlyoffice.com/docbuilder/basic");
let classType = hyperlink.GetClassType();
paragraph = Api.CreateParagraph();
paragraph.AddText("Class type: " + classType);
doc.Push(paragraph);