Skip to main content

GetLockAspect

Returns whether the aspect ratio of the drawing is locked.

Syntax​

expression.GetLockAspect();

expression - A variable that represents an ApiDrawing class.

Parameters​

This method doesn't have any parameters.

Returns​

boolean

Example​

Return whether the aspect ratio of the drawing is locked in a spreadsheet.

// Useful for checking the lock aspect ratio state of a shape in a spreadsheet.

// Create a shape, lock its aspect ratio and display the result.

let worksheet = Api.GetActiveSheet();
let fill = Api.CreateSolidFill(Api.RGB(255, 111, 61));
let stroke = Api.CreateStroke(0, Api.CreateNoFill());
let drawing = worksheet.AddShape("triangle", 60 * 36000, 35 * 36000, fill, stroke, 0, 2 * 36000, 0, 3 * 36000);
drawing.SetSize(120 * 36000, 70 * 36000);
drawing.SetPosition(0, 2 * 36000, 1, 3 * 36000);
drawing.SetLockAspect(true);
let lockAspect = drawing.GetLockAspect();
worksheet.GetRange("A1").SetValue("Aspect ratio locked: " + lockAspect);