Stroke class

Stroke class

Defines a stroke for a shape. To learn more, visit the Working with Shapes documentation article.

Remarks

Use the Shape.stroke property to access stroke properties of a shape. You do not create instances of the Stroke class directly.

Properties

NameDescription
backColorGets or sets the background color of the stroke.
backThemeColorGets or sets a ThemeColor object that represents the stroke background color.
backTintAndShadeGets or sets a double value that lightens or darkens the stroke background color.
baseForeColorGets the base foreground color of the stroke without any modifiers.
colorDefines the color of a stroke.
color2Defines a second color for a stroke.
dashStyleSpecifies the dot and dash pattern for a stroke.
endArrowLengthDefines the arrowhead length for the end of a stroke.
endArrowTypeDefines the arrowhead for the end of a stroke.
endArrowWidthDefines the arrowhead width for the end of a stroke.
endCapDefines the cap style for the end of a stroke.
fillGets fill formatting for the Stroke.
foreColorGets or sets the foreground color of the stroke.
foreThemeColorGets or sets a ThemeColor object that represents the stroke foreground color.
foreTintAndShadeGets or sets a double value that lightens or darkens the stroke foreground color.
imageBytesDefines the image for a stroke image or pattern fill.
joinStyleDefines the join style of a polyline.
lineStyleDefines the line style of the stroke.
onDefines whether the path will be stroked.
opacityDefines the amount of transparency of a stroke. Valid range is from 0 to 1.
startArrowLengthDefines the arrowhead length for the start of a stroke.
startArrowTypeDefines the arrowhead for the start of a stroke.
startArrowWidthDefines the arrowhead width for the start of a stroke.
transparencyGets or sets a value between 0.0 (opaque) and 1.0 (clear) representing the degree of transparency of the stroke.
visibleGets or sets a flag indicating whether the stroke is visible.
weightDefines the brush thickness that strokes the path of a shape in points.

Examples

Shows how change stroke properties.

let doc = new aw.Document();
let builder = new aw.DocumentBuilder(doc);

let shape = builder.insertShape(aw.Drawing.ShapeType.Rectangle, aw.Drawing.RelativeHorizontalPosition.LeftMargin, 100,
  aw.Drawing.RelativeVerticalPosition.TopMargin, 100, 200, 200, aw.Drawing.WrapType.None);

// Basic shapes, such as the rectangle, have two visible parts.
// 1 -  The fill, which applies to the area within the outline of the shape:
shape.fill.foreColor = "#FFFFFF";

// 2 -  The stroke, which marks the outline of the shape:
// Modify various properties of this shape's stroke.
let stroke = shape.stroke;
stroke.on = true;
stroke.weight = 5;
stroke.color = "#FF0000";
stroke.dashStyle = aw.Drawing.DashStyle.ShortDashDotDot;
stroke.joinStyle = aw.Drawing.JoinStyle.Miter;
stroke.endCap = aw.Drawing.EndCap.Square;
stroke.lineStyle = aw.Drawing.ShapeLineStyle.Triple;
stroke.fill.twoColorGradient("#FF0000", "#0000FF", aw.Drawing.GradientStyle.Vertical, aw.Drawing.GradientVariant.Variant1);

doc.save(base.artifactsDir + "Shape.stroke.docx");

See Also