Skip to main content

SetTitle

Sets the title of the current drawing.

Inherited from ApiDrawing.SetTitle.

Syntax​

expression.SetTitle(title);

expression - A variable that represents an ApiOleObject class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
titleRequiredstringThe title to set for the current drawing.

Returns​

boolean

Example​

Set the title of a drawing in a spreadsheet.

// Useful for assigning the alternative text title of a drawing.

// Create a drawing and set its title.

let worksheet = Api.GetActiveSheet();
let fill = Api.CreateSolidFill(Api.RGB(255, 111, 61));
let stroke = Api.CreateStroke(0, Api.CreateNoFill());
let drawing = worksheet.AddShape("cube", 60 * 36000, 35 * 36000, fill, stroke, 0, 2 * 36000, 0, 3 * 36000);
drawing.SetTitle("My Drawing Title");
let title = drawing.GetTitle();
worksheet.SetColumnWidth(0, 25);
worksheet.GetRange("A1").SetValue("Drawing title: " + title);