Collection of four IBorder interfaces that represent the four borders of a Range. Use the Borders property to return the IBorders collection, which contains all four borders. Use Borders[index], where index identifies the border, to return a single IBorder interface.
For a list of all members of this type, see IBorders Members.
[Visual Basic] Public Interface IBorders [C#] public interface IBorders [C++] public __gc __interface IBorders [JScript] public interface IBorders
The following example adds a double red border to cell A1 on worksheet one.
[C#]
IBorders borders = book.Worksheets[1].Range["A1"].Borders;
borders.LineStyle = XlLineStyle.xlDouble;
borders.Color = System.Drawing.Color.Red;
[Visual Basic]
Dim borders As IBorders = book.Worksheets(1).Range("A1").Borders
borders.LineStyle = XlLineStyle.xlDouble
borders.Color = System.Drawing.Color.Red
[C++]
IBorders* borders = book->Worksheets->Item[1]->Range->Item[S"A1"]->Borders;
borders->LineStyle = XlLineStyle::xlDouble;
borders->Color = System::Drawing::Color::Red;
The following example sets the color of the bottom border of cells A1:G1 to red. [C#]
book.Worksheets[1].Range["A1","G1"].Borders[XlBordersIndex.xlEdgeBottom].Color = Color.FromArgb(255, 0, 0);
[Visual Basic]
book.Worksheets(1).Range("A1","G1").Borders(XlBordersIndex.xlEdgeBottom).Color = Color.FromArgb(255, 0, 0)
[C++]
book->Worksheets->Item[1]->Range->Item[S"A1",S"G1"]->Borders->Item[XlBordersIndex::xlEdgeBottom]->Color = Color::FromArgb(255, 0, 0);
Namespace: NativeExcel
Assembly: NativeExcel (in NativeExcel.dll)
IBorders Members | NativeExcel Namespace | IRange.Borders Property