跳到主要内容

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 presentation = Api.GetPresentation();
let slide = presentation.GetSlideByIndex(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);
shape.SetPosition(2000000, 1000000);
slide.AddObject(shape);
let content = shape.GetDocContent();
let paragraph = content.GetElement(0);
paragraph.AddText("Original shape with no border");
let newStroke = Api.CreateStroke(3 * 12700, Api.CreateSolidFill(Api.CreateRGBColor(0, 0, 255)));
shape.SetLine(newStroke);
paragraph.AddLineBreak();
paragraph.AddText("Border changed to 3pt blue line");