Border class

Border class

Represents a border of an object. To learn more, visit the Programming with Documents documentation article.

Remarks

Borders can be applied to various document elements including paragraph, run of text inside a paragraph or a table cell.

Inheritance: BorderInternableComplexAttr

Properties

NameDescription
colorGets or sets the border color.
distanceFromTextGets or sets distance of the border from text or from the page edge in points.
isVisibleReturns true if the Border.lineStyle is not LineStyle.None.
lineStyleGets or sets the border style.
lineWidthGets or sets the border width in points.
shadowGets or sets a value indicating whether the border has a shadow.
themeColorGets or sets the theme color in the applied color scheme that is associated with this Border object.
tintAndShadeGets or sets a double value that lightens or darkens a color.

Methods

NameDescription
clearFormatting()Resets border properties to default values.
equals(rhs)Determines whether the specified border is equal in value to the current border.

Examples

Shows how to insert a string surrounded by a border into a document.

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

builder.font.border.color = "#008000";
builder.font.border.lineWidth = 2.5;
builder.font.border.lineStyle = aw.LineStyle.DashDotStroker;

builder.write("Text surrounded by green border.");

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

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