NativeExcel2 for .Net Developer's Reference

IBorders Interface

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]


The following example adds a double red border to cell A1 on worksheet one.

IBorders borders = book.Worksheets[1].Range["A1"].Borders;
borders.LineStyle = XlLineStyle.xlDouble; 
borders.Color = System.Drawing.Color.Red;
Dim borders As IBorders = book.Worksheets(1).Range("A1").Borders 
borders.LineStyle = XlLineStyle.xlDouble 
borders.Color = System.Drawing.Color.Red
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.
book.Worksheets[1].Range["A1","G1"].Borders[XlBordersIndex.xlEdgeBottom].Color = Color.FromArgb(255, 0, 0);
book.Worksheets(1).Range("A1","G1").Borders(XlBordersIndex.xlEdgeBottom).Color = Color.FromArgb(255, 0, 0)
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)

See Also

IBorders Members | NativeExcel Namespace | IRange.Borders Property