[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.ColorUtilities.StringToColor

StringToColor Method

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.

Declaration
public static Color StringToColor(string colorString)
Public Shared Function StringToColor(colorString As String) As Color
Parameters
Type Name Description
string colorString

The color string to convert. This value may be null; if it cannot be parsed, a fully transparent color is returned.

Returns
Type Description
Color

The Color represented by colorString. Returns a fully transparent color if parsing fails.

Examples
Color fillColor = ColorUtilities.StringToColor("rgba(255,0,0,0.5)");
worksheet.Range["B2"].Interior.Color = fillColor;