跳到主要内容

GetClassType

返回 ApiImage 类的类型。

语法

expression.GetClassType();

expression - 表示 ApiImage 类的变量。

参数

此方法没有任何参数。

返回值

"image"

示例

检索文档中图像元素的类类型。

// How do I get the type identifier of an image object in a document?

// Display what kind of drawing element an image is classified as in a document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let drawing = Api.CreateImage(
'https://static.onlyoffice.com/assets/docs/samples/img/onlyoffice_logo.png',
60 * 36000, 60 * 36000
);
paragraph.AddDrawing(drawing);
let classType = drawing.GetClassType();
paragraph = Api.CreateParagraph();
paragraph.AddText('Class Type = ' + classType);
doc.Push(paragraph);