Page tree
Skip to end of metadata
Go to start of metadata

Description

The Color class represents a single color in a spreadsheet's color palette.

C#
vb.net

Remarks

Each Excel document has a single color palette that manages the colors for formatting and some drawing layer colors. A color palette contains 56 colors that may be referenced. Each of these 56 colors may be customized, but changing a color in the palette will affect all formatting that uses the referenced color. To get a Color object, use Workbook.Palette to get to the Workbook's palette, then use one of the Palette's methods to get a Color.

Examples

C#
vb.net

Properties

Name

Description

Blue

Returns the blue component of the color's RGB value.

Green

Returns the green component of color's the RGB value.

IsCustomColor

Returns whether or not the color is a custom color.

IsPaletteColor

Returns whether or not the color is stored in Excel's default color palette. For .xlsx files, returns whether the color has been retrieved from the legacy palette. The only way to retrieve colors from the legacy palette is by using the Palette.SetColorAt or Palette.GetColorAt methods.

IsSystemColor

Returns whether or not the color is a system color that cannot be changed.

PaletteIndex

For palette colors, returns the 0-based index of the color in the spreadsheet's color palette. For custom colors, this property will return a negative number. Automatic colors will return an index greater than or equal to 56 (the maximum index in the palette).

Red

Returns the red component of the color's RGB value.

Methods

Name

Description

ToString()

Returns a string representation of the Color object.

Nested Classes

Name

Description

SystemColor

System colors that can be used as colors in ExcelWriter
  • No labels