NativeExcel for .Net Developer's Reference

IInterior.PatternColorIndex Property

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

[Visual Basic]

Property Value

The color index of the specified interior pattern.


Set this property to XlColorIndex.xlColorIndexAutomatic to specify the automatic pattern for cells. Set this property to XlColorIndex.xlColorIndexNone to specify that you don't want a pattern (this is the same as setting the Pattern property of the Interior interface to XlPattern.xlPatternNone).


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

IInterior interior = book.Worksheets[1].Cells["A1:C10"].Interior;
interior.Pattern = XlPattern.xlChecker;
interior.PatternColorIndex = 8;
Dim interior As IInterior = book.Worksheets(1).Cells("A1:C10").Interior
interior.Pattern = XlPattern.xlChecker
interior.PatternColorIndex = 8
IInterior* interior = book->Worksheets->Item[1].Cells->Item[S"A1:C10"]->Interior;
interior->Pattern = XlPattern::xlChecker;
interior->PatternColorIndex = 8;
This example deletes interior pattern from a range A1:C5.
book.Worksheets[1].Range["A1:C5"].Interior.PatternColorIndex = XlColorIndex.xlColorIndexNone;
book.Sheet(1).Range("A1:C5").Interior.PatternColorIndex = XlColorIndex.xlColorIndexNone
IInterior* interior = book->Worksheets->Item[1]->Range->Item[S"A1:C5"]->Interior;
interior->PatternColorIndex = XlColorIndex::xlColorIndexNone;

See Also

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