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.
Indexers
Name | Description |
---|---|
__getitem__(index) | Retrieves a Border object by index. |
Properties
Name | Description |
---|---|
bottom | Gets the bottom border. |
color | Gets or sets the border color. |
count | Gets the number of borders in the collection. |
distance_from_text | Gets or sets distance of the border from text in points. |
horizontal | Gets the horizontal border that is used between cells or conforming paragraphs. |
left | Gets the left border. |
line_style | Gets or sets the border style. |
line_width | Gets or sets the border width in points. |
right | Gets the right border. |
shadow | Gets or sets a value indicating whether the border has a shadow. |
top | Gets the top border. |
vertical | Gets the vertical border that is used between cells. |
Methods
Name | Description |
---|---|
clear_formatting() | Removes all borders of an object. |
equals(br_coll) | Compares collections of borders. |
get_by_border_type(border_type) | Retrieves a Border object by border type. |
Examples
Shows how to insert a paragraph with a top border.
doc = aw.Document()
builder = aw.DocumentBuilder(doc=doc)
top_border = builder.paragraph_format.borders.top
top_border.line_width = 4
top_border.line_style = aw.LineStyle.DASH_SMALL_GAP
# Set ThemeColor only when LineWidth or LineStyle setted.
top_border.theme_color = aw.themes.ThemeColor.ACCENT1
top_border.tint_and_shade = 0.25
builder.writeln('Text with a top border.')
doc.save(file_name=ARTIFACTS_DIR + 'Border.ParagraphTopBorder.docx')
See Also
- module aspose.words