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]
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);

Example

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

[C#]
book.Worksheets[1].Range["A1"].Font.ColorIndex = 3;
[Visual Basic]
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