跳到主要内容

GetClassType

返回 ApiTextPr 类的类型。

语法

expression.GetClassType();

expression - 表示 ApiTextPr 类的变量。

参数

此方法没有任何参数。

返回值

"textPr"

示例

获取文档中文本属性的类类型。

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

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

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("This is a sample text with the font size set to 30 and the font weight set to bold.");
let textPr = Api.CreateTextPr();
textPr.SetFontSize(32);
textPr.SetBold(true);
paragraph.SetTextPr(textPr);
textPr = paragraph.GetTextPr();
let classType = textPr.GetClassType();
paragraph = Api.CreateParagraph();
paragraph.AddText("Class type: " + classType);
doc.Push(paragraph);