Skip to main content

GetName

Returns the name of the current drawing.

Syntax

expression.GetName();

expression - A variable that represents a ApiDrawing class.

Parameters

This method doesn't have any parameters.

Returns

string

Example

This example shows how to get the name of a drawing object.

const worksheet = Api.GetActiveSheet();

const fill = Api.CreateSolidFill(Api.HexColor('#5B9BD5'));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const drawing = worksheet.AddShape(
'rect',
Api.MillimetersToEmus(80), Api.MillimetersToEmus(40),
fill, stroke,
0, 0, 1, 0
);

drawing.SetName('MyRectangle');
const drawingName = drawing.GetName();
worksheet.GetRange('A1').SetValue('Drawing name: ' + drawingName);