Forums     Knowledge Base     OfficeWriter Online     
 
This documentation is for
OfficeWriter v3.0.4
.NET Platform

View Docs for Another
Version or Platform

Programmer's Reference > ExcelApplication API > Color

The Color Object


The Color class represents a single color in a spreadsheet's color palette. 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:

[csharp]
ExcelApplication xla = new ExcelApplication();
Workbook wb = xla.Create();
Palette p = wb.Palette;
SoftArtisans.OfficeWriter.ExcelApplication.Color clr = 
p.GetClosestColor(System.Drawing.Color.Blue);
[vbnet]
Dim xla As New ExcelApplication
Dim wb As Workbook = xla.Create()
Dim p As Palette = wb.Palette()
Dim clr As SoftArtisans.OfficeWriter.ExcelApplication.Color =_
 p.GetClosestColor(System.Drawing.Color.Blue)


Color Constants

NameDescription
Color.SystemColor.Black Black
Color.SystemColor.White White
Color.SystemColor.Red Red
Color.SystemColor.Green Green
Color.SystemColor.Blue Blue
Color.SystemColor.Yellow Yellow
Color.SystemColor.Magenta Magenta
Color.SystemColor.Cyan Cyan
Color.SystemColor.AutomaticLine Automatic line color
Color.SystemColor.AutomaticFill Automatic fill color


Color Properties

Property Type Access Description
Blue int read

Returns the blue component of the color's RGB value

Green int read

Returns the green component of color's the RGB value

IsCustomColor boolean

Returns whether or not the color is a custom color that is not part of Excel's default color palette

IsPaletteColor boolean read

Returns whether or not the color is stored in Excel's default color palette

IsSystemColor boolean

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

PaletteIndex int read

Returns the 0-based index of the color in the spreadsheet's color palette

Red int read

Returns the red component of the color's RGB value



This object does not have any methods defined.



Copyright 2005 © SoftArtisans, Inc. All Rights Reserved.