BorderCollection class

BorderCollection class

A collection of Border objects. To learn more, visit the Programming with Documents documentation article.

Remarks

Different document elements have different borders. For example, ParagraphFormat has BorderCollection.bottom, BorderCollection.left, BorderCollection.right and BorderCollection.top borders. You can specify different formatting for each border independently or enumerate through all borders and apply same formatting.

Properties

NameDescription
bottomGets the bottom border.
colorGets or sets the border color.
countGets the number of borders in the collection.
distanceFromTextGets or sets distance of the border from text in points.
horizontalGets the horizontal border that is used between cells or conforming paragraphs.
leftGets the left border.
lineStyleGets or sets the border style.
lineWidthGets or sets the border width in points.
rightGets the right border.
shadowGets or sets a value indicating whether the border has a shadow.
this[]
this[]
topGets the top border.
verticalGets the vertical border that is used between cells.

Methods

NameDescription
clearFormatting()Removes all borders of an object.
equals(brColl)Compares collections of borders.

Examples

Shows how to insert a paragraph with a top border.

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

let topBorder = builder.paragraphFormat.borders.top;
topBorder.lineWidth = 4.0;
topBorder.lineStyle = aw.LineStyle.DashSmallGap;
// Set ThemeColor only when LineWidth or LineStyle setted.
topBorder.themeColor = aw.Themes.ThemeColor.Accent1;
topBorder.tintAndShade = 0.25;

builder.writeln("Text with a top border.");

doc.save(base.artifactsDir + "Border.ParagraphTopBorder.docx");

See Also