Skip to main content

GetClassType

Returns a type of the ApiImage class.

Syntax

expression.GetClassType();

expression - A variable that represents a ApiImage class.

Parameters

This method doesn't have any parameters.

Returns

"image"

Example

Check the class type returned by an image in a document.

// How do I check what type an image object is in a document?

// Retrieve and output the class type string for an image 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);