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 aColor
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 |
---|---|
Returns the blue component of the color's RGB value. | |
Returns the green component of color's the RGB value. | |
Returns whether or not the color is a custom color. | |
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. | |
Returns whether or not the color is a system color that cannot be changed. | |
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). | |
Returns the red component of the color's RGB value. |
Methods
Name |
Description |
---|---|
Returns a string representation of the Color object. |
Nested Classes
Name |
Description |
---|---|
System colors that can be used as colors in ExcelWriter |