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]
PropertyPatternColorIndexAsInteger
[C#]
intPatternColorIndex{get;set;}
[C++]
__propertyintget_PatternColorIndex();
__propertyvoidset_PatternColorIndex(int);
[JScript]
functiongetPatternColorIndex():int
functionsetPatternColorIndex(int);

Property Value

The color index of the specified interior pattern.

Remarks

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).

Example

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

[C#]
IInterior interior = book.Worksheets[1].Cells["A1:C10"].Interior;
interior.Pattern = XlPattern.xlChecker;
interior.PatternColorIndex = 8;
[VisualBasic]
Dim interior As IInterior = book.Worksheets(1).Cells("A1:C10").Interior
interior.Pattern = XlPattern.xlChecker
interior.PatternColorIndex = 8
[C++]
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.
[C#]
book.Worksheets[1].Range["A1:C5"].Interior.PatternColorIndex = XlColorIndex.xlColorIndexNone;
[VisualBasic]
book.Sheet(1).Range("A1:C5").Interior.PatternColorIndex = XlColorIndex.xlColorIndexNone
[C++]
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