NanoXLSX.Core 3.0.0-rc.4
Loading...
Searching...
No Matches
NanoXLSX.Utils.Validators Class Reference

Class providing general validator methods. More...

Static Public Member Functions

static void ValidateGenericColor (string hexCode, bool allowEmpty=false)
 Validates the passed string, whether it is a valid RGB or ARGB value that can be used for Fills, Fonts or other styling components. The method automatically tries to validate for ARGB (8 characters) first, then for RGB (6 characters).
static void ValidateColor (string hexCode, bool useAlpha, bool allowEmpty=false)
 Validates the passed string, whether it is a valid RGB or ARGB value that can be used for Fills, Fonts or other styling components.

Detailed Description

Class providing general validator methods.

Definition at line 10 of file Validators.cs.

Member Function Documentation

◆ ValidateColor()

void NanoXLSX.Utils.Validators.ValidateColor ( string hexCode,
bool useAlpha,
bool allowEmpty = false )
static

Validates the passed string, whether it is a valid RGB or ARGB value that can be used for Fills, Fonts or other styling components.

Exceptions
StyleExceptionA StyleException is thrown if an invalid hex value is passed
Parameters
hexCodeHex string to check
useAlphaIf true, two additional characters (total 8) are expected as alpha value
allowEmptyOptional parameter that allows null or empty as valid values

Definition at line 40 of file Validators.cs.

◆ ValidateGenericColor()

void NanoXLSX.Utils.Validators.ValidateGenericColor ( string hexCode,
bool allowEmpty = false )
static

Validates the passed string, whether it is a valid RGB or ARGB value that can be used for Fills, Fonts or other styling components. The method automatically tries to validate for ARGB (8 characters) first, then for RGB (6 characters).

Parameters
hexCodeHex string to check
allowEmptyOptional parameter that allows null or empty as valid values

Definition at line 19 of file Validators.cs.


The documentation for this class was generated from the following file: