NativeExcel for .Net Developer's Reference

IFont.ColorIndex Property

Returns or sets the color of the font. 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]
PropertyColorIndexAsInteger
[C#]
intColorIndex{get;set;}
[C++]
__propertyintget_ColorIndex();
__propertyvoidset_ColorIndex(int);
[JScript]
functiongetColorIndex():int
functionsetColorIndex(int);

Example

This example changes the font color in cell A1 on sheet one to red.

[C#]
book.Worksheets[1].Range["A1"].Font.ColorIndex = 3;
[VisualBasic]
book.Worksheets(1).Range("A1").Font.ColorIndex = 3
[C++]
book->Worksheets->Item[1]->Range->Item[S"A1"]->Font->ColorIndex = 3;

See Also

IFont Interface | NativeExcel Namespace