Skip to main content

SetLine

Sets the outline properties to the current shape.

Syntax

expression.SetLine(oStroke);

expression - A variable that represents a ApiShape class.

Parameters

NameRequired/OptionalData typeDefaultDescription
oStrokeRequiredApiStrokeThe stroke used to create the shape outline.

Returns

boolean

Example

Sets the outline properties to a shape.

// Creates a rectangle and changes its outline to a thick blue line.
let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let fill = Api.CreateSolidFill(Api.CreateRGBColor(255, 200, 100));
let stroke = Api.CreateStroke(0, Api.CreateNoFill());
let shape = Api.CreateShape("rect", 100 * 36000, 50 * 36000, fill, stroke);
paragraph.AddDrawing(shape);
paragraph.AddLineBreak();
paragraph.AddText("Original shape with no border");
paragraph.AddLineBreak();
let newStroke = Api.CreateStroke(3 * 12700, Api.CreateSolidFill(Api.CreateRGBColor(0, 0, 255)));
shape.SetLine(newStroke);
paragraph.AddText("Border changed to 3pt blue line");