Returns or sets the color of the border. The color is specified as an index value into the current color palette, or as the following XlColorIndex constant: xlColorIndexAutomatic, xlColorIndexNone. Read/write int.
[Visual Basic] Property ColorIndex As Integer [C#] int ColorIndex { get; set; } [C++] __property int get_ColorIndex(); __property void set_ColorIndex(int ); [JScript] function get ColorIndex() : int function set ColorIndex(int);
This example sets the color of the top edge border of A1:D1 range.
[C#]
book.Worksheets[1].Range["A1:D1"].Borders[XlBordersIndex.xlEdgeTop].ColorIndex = 3;
[Visual Basic]
book.Worksheets(1).Range("A1:D1").Borders(XlBordersIndex.xlEdgeTop).ColorIndex = 3
[C++]
IRange* range = book->Worksheets->Item[1]->Range->Item[S"A1:D1"];
IBorder* border = range->Borders->Item[XlBordersIndex::xlEdgeTop];
border->ColorIndex = 3;
This example removes the top border of the cell A1. [C#]
book.Worksheets[1].Range["A1"].Borders[XlBordersIndex.xlEdgeTop].ColorIndex = XlColorIndex.xlColorIndexNone;
[Visual Basic]
book.Worksheets(1).Range("A1").Borders(XlBordersIndex.xlEdgeTop).ColorIndex = XlColorIndex.xlColorIndexNone
[C++]
IRange* range = book->Worksheets->Item[1]->Range->Item[S"A1"];
IBorder* border = range->Borders->Item[XlBordersIndex::xlEdgeTop];
border->ColorIndex = XlColorIndex::xlColorIndexNone;
This example sets the color of the top border of A1:D1 range to Automatic. [C#]
book.Worksheets[1].Range["A1:D1"].Borders[XlBordersIndex.xlEdgeTop].ColorIndex = XlColorIndex.xlColorIndexAutomatic;
[Visual Basic]
book.Worksheets(1).Range("A1:D1").Borders(XlBordersIndex.xlEdgeTop).ColorIndex = XlColorIndex.xlColorIndexAutomatic
[C++]
IRange* range = book->Worksheets->Item[1]->Range->Item[S"A1:D1"];
IBorder* border = range->Borders->Item[XlBordersIndex::xlEdgeTop];
border->ColorIndex = XlColorIndex::xlColorIndexAutomatic;
IBorder Interface | NativeExcel Namespace | XlBordersIndex Enumeration | XlColorIndex Class | IRange.Borders Property | IBorders Interface