Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Wiki Markup
{description}
{excerpt}The {msdn:System.Drawing.Color|Color} class represents a single color in a spreadsheet's color palette. {excerpt}
{signature:C#}
 public sealed class Color
{signature}{signature:vb.net}
Public NotInheritable Class Color
{signature}
{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}}.
{remarks}
{example}{code:csharp|title=C#}

ExcelApplication xla = new ExcelApplication();
Workbook wb = xla.Create();
Palette p = wb.Palette;
SoftArtisans.OfficeWriter.ExcelApplication.Color clr =
    p.GetClosestColor(System.Drawing.Color.Blue);
{code}
{code:vbnet|title=vb.net}

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)
{code}

{example}
{properties}
||Name||Description||
|[Blue|Color.Blue]|{excerpt-include:Color.Blue|nopanel=true}|
|[Green|Color.Green]|{excerpt-include:Color.Green|nopanel=true}|
|[IsCustomColor|Color.IsCustomColor]|{excerpt-include:Color.IsCustomColor|nopanel=true}|
|[IsPaletteColor|Color.IsPaletteColor]|{excerpt-include:Color.IsPaletteColor|nopanel=true}|
|[IsSystemColor|Color.IsSystemColor]|{excerpt-include:Color.IsSystemColor|nopanel=true}|
|[PaletteIndex|Color.PaletteIndex]|{excerpt-include:Color.PaletteIndex|nopanel=true}|
|[Red|Color.Red]|{excerpt-include:Color.Red|nopanel=true}|
{methods}
||Name||Description||
|[ToString()|Color.ToString()]|{excerpt-include:Color.ToString()|nopanel=true}|
{classes}
||Name||Description||
|[SystemColor|Color.SystemColor]|{excerpt-include:Color.SystemColor|nopanel=true}|