NativeExcel2 for .Net Developer's Reference

IBorder.Color Property

Returns or sets the color of the border. Use the Color.FromArgb method to create a color value. Read/write System.Drawing.Color.

[Visual Basic]
PropertyColorAsColor
[C#]
ColorColor{get;set;}
[C++]
__propertyColorget_Color();
__propertyvoidset_Color(Color);
[JScript]
functiongetColor():Color
functionsetColor(Color);

Example

This example sets the color of the top edge border of A1:D1 range.

[C#]
book.Worksheets[1].Range["A1:D1"].Borders[XlBordersIndex.xlEdgeTop].Color = Color.FromArgb(0, 255, 0);
[VisualBasic]
book.Worksheets(1).Range("A1:D1").Borders(XlBordersIndex.xlEdgeTop).Color = Color.FromArgb(0, 255, 0)
[C++]
IRange* range = book->Worksheets->Item[1]->Range->Item[S"A1:D1"];
IBorder* border = range->Borders->Item[XlBordersIndex::xlEdgeTop];  
border->Color = Color::FromArgb(0, 255, 0);

See Also

IBorder Interface | NativeExcel Namespace | XlBordersIndex Enumeration | IRange.Borders Property | IBorders Interface