NativeExcel for .Net Developer's Reference

IInterior.ColorIndex Property

Gets or sets the color of the interior as an index into the current color palette, or as one of the XlColorIndex values.

[Visual Basic]
PropertyColorIndexAsInteger
[C#]
intColorIndex{get;set;}
[C++]
__propertyintget_ColorIndex();
__propertyvoidset_ColorIndex(int);
[JScript]
functiongetColorIndex():int
functionsetColorIndex(int);

Property Value

The color index of the specified interior.

Remarks

Set this property to XlColorIndex.xlColorIndexAutomatic to specify the automatic fill. Set this property to XlColorIndex.xlColorIndexNone to specify no interior fill.

Example

This example sets the color index of the range A1:C10 interior to 10.

[C#]
IInterior interior = book.Worksheets[1].Cells["A1:C10"].Interior;
interior.Pattern = XlPattern.xlChecker;
interior.PatternColorIndex = 8;
interior.ColorIndex = 10;
[VisualBasic]
Dim interior As IInterior = book.Worksheets(1).Cells("A1:C10").Interior
interior.Pattern = XlPattern.xlChecker
interior.PatternColorIndex = 8
interior.ColorIndex = 10
[C++]
IInterior* interior = book->Worksheets->Item[1].Cells->Item[S"A1:C10"]->Interior;
interior->Pattern = XlPattern::xlChecker;
interior->PatternColorIndex = 8;
interior->ColorIndex = 10;

See Also

IInterior Interface | NativeExcel Namespace | XlColorIndex Class | IPalette Interface | Colors Property | Interior Property