[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.ColorUtilities

ColorUtilities Class

Provides utility methods for working with colors.

This class converts color strings into Color objects that can be used in workbook APIs such as cell fill and border formatting. Use StringToColor(string) to create colors from standard color names, RGB and RGBA expressions, and hexadecimal color strings.

Inheritance
ColorUtilities
Namespace: GrapeCity.Documents.Excel
Assembly: DS.Documents.Excel.dll
Syntax
public static class ColorUtilities
Public Module ColorUtilities
Examples
Color fillColor = ColorUtilities.StringToColor("rgba(255,0,0,0.5)");
Color borderColor = ColorUtilities.StringToColor("#000000");
worksheet.Range["B2"].Interior.Color = fillColor;
worksheet.Range["B2"].Borders.Color = borderColor;

Methods

Name Description
StringToColor(string)

Converts a color string to a Color object.

Supported formats include RGB expressions such as "rgb(255,0,0)", RGBA expressions such as "rgba(255,0,0,0.5)", hexadecimal values such as "#F00" and "#FF0000", hexadecimal values with alpha such as "#F00C" and "#FF0000CC", and predefined color names such as "red".

If the input cannot be parsed, this method returns a fully transparent color.