Interface IBorder
Interface for cell border value
Namespace: IronXL.Styles
Assembly: IronXL.dll
Syntax
public interface IBorder
IBorder is what a cell's style hands back for one edge of its border. Each side of a cell, read through IStyle, returns this contract so a developer can set the line's color and weight independently, which is how a header underline or a boxed total is drawn.
A developer reaches IBorder through the border properties of IStyle: TopBorder, BottomBorder, LeftBorder, RightBorder, and DiagonalBorder, all get-only and all reached from Cell.Style or Range.Style. There is no construction step; read the side you want and set it. Assigning through a range's style applies the same edge across the whole selection.
Color sets the line color as an RGB string and Type takes a BorderType for the weight and style, such as thin, medium, or thick. The SetBorderStyle method sets both at once, accepting either a Color or an RGB string alongside a BorderType, and SetColor updates only the color. Set the type to a visible weight; a color alone on a None border will not render.
using IronXL;
using IronXL.Styles;
WorkSheet sheet = WorkBook.Load("report.xlsx").DefaultWorkSheet;
sheet["A1:D1"].Style.BottomBorder.SetBorderStyle("#000000", BorderType.Medium);The border and alignment how-to covers borders in context, and the style cells, borders, and fonts example shows them alongside fonts and fills.
Properties
Color
Property that returns border color in rgb format.
Declaration
string Color { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Type
Gets or sets the type of the border line. See BorderType
Declaration
BorderType Type { get; set; }
Property Value
| Type | Description |
|---|---|
| BorderType |
Methods
SetBorderStyle(Color, BorderType)
Method for setting border type and color. Default border type is thin.
Declaration
void SetBorderStyle(Color color, BorderType type)
Parameters
| Type | Name | Description |
|---|---|---|
| IronSoftware.Drawing.Color | color | Color value |
| BorderType | type | Border type enum |
SetBorderStyle(String, BorderType)
Method for setting border type and color. Default border type is thin.
Declaration
void SetBorderStyle(string rgb, BorderType type)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | rgb | Color rgb value |
| BorderType | type | Border type enum |
SetColor(Color)
Method for setting border color with Color value
Declaration
void SetColor(Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| IronSoftware.Drawing.Color | color | Color value |
SetColor(String)
Method for setting border color with the rgb string.
Declaration
void SetColor(string rgb)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | rgb | Color rgb value |