Border Class

Represents a border of an object.
Inheritance Hierarchy

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.2
public class Border : InternableComplexAttr

The Border type exposes the following members.

Public propertyCode exampleColor
Gets or sets the border color.
Public propertyCode exampleDistanceFromText
Gets or sets distance of the border from text or from the page edge in points.
Public propertyCode exampleIsVisible
Returns true if the LineStyle is not LineStyle.None.
Public propertyCode exampleLineStyle
Gets or sets the border style.
Public propertyCode exampleLineWidth
Gets or sets the border width in points.
Public propertyCode exampleShadow
Gets or sets a value indicating whether the border has a shadow.
Public methodCode exampleClearFormatting
Resets border properties to default values.
Public methodCode exampleEquals(Object)
Determines whether the specified object is equal in value to the current object.
(Overrides ObjectEquals(Object).)
Public methodCode exampleEquals(Border)
Determines whether the specified border is equal in value to the current border.
Protected methodFinalize (Inherited from Object.)
Public methodCode exampleGetHashCode
Serves as a hash function for this type.
(Overrides ObjectGetHashCode.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Protected methodNotifyChanging (Inherited from InternableComplexAttr.)
Public methodToString (Inherited from Object.)

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

Shows how to insert a string surrounded by a border into a document.
DocumentBuilder builder = new DocumentBuilder();

builder.Font.Border.Color = Color.Green;
builder.Font.Border.LineWidth = 2.5;
builder.Font.Border.LineStyle = LineStyle.DashDotStroker;

builder.Write("run of text in a green border");
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