Border Class
Represents a border of an object.
Inheritance Hierarchy

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.9
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 methodEquals(Border)
Determines whether the specified border is equal in value to the current border.
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodCode exampleGetHashCode
Serves as a hash function for this type.
(Overrides ObjectGetHashCode.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodNotifyChanging (Inherited from InternableComplexAttr.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)

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

Inserts 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");
Inserts 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