BorderCollection Class

A collection of Border objects.
Inheritance Hierarchy

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.2
public sealed class BorderCollection : IEnumerable<Border>, 

The BorderCollection type exposes the following members.

Public propertyCode exampleBottom
Gets the bottom border.
Public propertyCode exampleColor
Gets or sets the border color.
Public propertyCode exampleCount
Gets the number of borders in the collection.
Public propertyCode exampleDistanceFromText
Gets or sets distance of the border from text in points.
Public propertyCode exampleHorizontal
Gets the horizontal border that is used between cells or conforming paragraphs.
Public propertyCode exampleItemInt32
Retrieves a Border object by index.
Public propertyCode exampleItemBorderType
Retrieves a Border object by border type.
Public propertyCode exampleLeft
Gets the left border.
Public propertyCode exampleLineStyle
Gets or sets the border style.
Public propertyCode exampleLineWidth
Gets or sets the border width in points.
Public propertyCode exampleRight
Gets the right border.
Public propertyCode exampleShadow
Gets or sets a value indicating whether the border has a shadow.
Public propertyCode exampleTop
Gets the top border.
Public propertyCode exampleVertical
Gets the vertical border that is used between cells.
Public methodCode exampleClearFormatting
Removes all borders of an object.
Public methodEquals(Object) (Inherited from Object.)
Public methodCode exampleEquals(BorderCollection)
Compares collections of borders.
Public methodCode exampleGetEnumerator
Returns an enumerator object that can be used to iterate over all borders in the collection.
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodToString (Inherited from Object.)
Different document elements have different borders. For example, ParagraphFormat has Bottom, Left, Right and Top borders. You can specify different formatting for each border independently or enumerate through all borders and apply same formatting.
Shows how to insert a paragraph with a top border.
DocumentBuilder builder = new DocumentBuilder();

Border topBorder = builder.ParagraphFormat.Borders[BorderType.Top];
topBorder.Color = Color.Red;
topBorder.LineStyle = LineStyle.DashSmallGap;
topBorder.LineWidth = 4;

builder.Writeln("Hello World!");
See Also