Border class

Border class

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

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

Inheritance: BorderInternableComplexAttr


Name Description
color Gets or sets the border color.
distance_from_text Gets or sets distance of the border from text or from the page edge in points.
is_visible Returns True if the Border.line_style is not LineStyle.NONE.
line_style Gets or sets the border style.
line_width Gets or sets the border width in points.
shadow Gets or sets a value indicating whether the border has a shadow.
theme_color Gets or sets the theme color in the applied color scheme that is associated with this Border object.
tint_and_shade Gets or sets a double value that lightens or darkens a color.


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


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

doc = aw.Document()
builder = aw.DocumentBuilder(doc)

builder.font.border.color =
builder.font.border.line_width = 2.5
builder.font.border.line_style = aw.LineStyle.DASH_DOT_STROKER

builder.write("Text surrounded by green border.") + "Border.font_border.docx")

Shows how to insert a paragraph with a top border.

doc = aw.Document()
builder = aw.DocumentBuilder(doc)

top_border =
top_border.line_width = 4.0
top_border.line_style = aw.LineStyle.DASH_SMALL_GAP
# Set ThemeColor only when LineWidth or LineStyle setted.
top_border.theme_color = awthemes.ThemeColor.ACCENT1
top_border.tint_and_shade = 0.25

builder.writeln("Text with a top border.") + "Border.paragraph_top_border.docx")

See Also