NanoXLSX.Core 3.0.0-rc.4
Loading...
Searching...
No Matches
NanoXLSX.Styles.Fill Class Reference

Class representing a Fill (background) entry. The Fill entry is used to define background colors and fill patterns. More...

Inheritance diagram for NanoXLSX.Styles.Fill:

Public Types

enum  FillType { PatternColor , FillColor }
 Enum for the type of the color, used by the Fill class. More...
enum  PatternValue {
  None , Solid , DarkGray , MediumGray ,
  LightGray , Gray0625 , Gray125
}
 Enum for the pattern values, used by the Fill class. More...

Public Member Functions

 Fill ()
 Default constructor.
 Fill (string foreground, string background)
 Constructor with foreground and background color as sRGB values (without alpha).
 Fill (string value, FillType fillType)
 Constructor with color value as sRGB and fill type.
override string ToString ()
 Override toString method.
override AbstractStyle Copy ()
 Method to copy the current object to a new one without casting.
override int GetHashCode ()
 Returns a hash code for this instance.
override bool Equals (object obj)
 Returns whether two instances are the same.
Fill CopyFill ()
 Method to copy the current object to a new one with casting.
void SetColor (string value, FillType fillType)
 Sets the color depending on fill type, using a sRGB value (without alpha).
void SetColor (Color value, FillType fillType)
 Sets the color depending on fill type, using a color object of the type Color.
void SetColor (IColor value, FillType fillType)
 Sets the color depending on fill type, using a color object, deriving from IColor.
Public Member Functions inherited from NanoXLSX.Styles.AbstractStyle
AbstractStyle Copy ()
 Abstract method to copy a component (dereferencing).
int CompareTo (AbstractStyle other)
 Method to compare two objects for sorting purpose.
bool Equals (AbstractStyle other)
 Method to compare two objects for sorting purpose.

Static Public Member Functions

static implicit operator Fill (string value)
 Implicit operator to create a Fill object from a string (RGB or ARGB) as foreground color with FillType.FillColor.
static implicit operator Fill (IndexedColor.Value index)
 Implicit operator to create a Fill object from an indexed color value (IndexedColor.Value) as foreground color with FillType.FillColor.
static implicit operator Fill (int index)
 Implicit operator to create a Fill object from an indexed color index (numeric) as foreground color with FillType.FillColor.

Static Public Attributes

static readonly Color DefaultColor = Color.CreateRgb(SrgbColor.DefaultSrgbColor)
 Default Color (foreground or background).
static readonly Color DefaultIndexedColor = Color.CreateIndexed(IndexedColor.DefaultIndexedColor)
 Default index color.
static readonly PatternValue DefaultPatternFill = PatternValue.None
 Default pattern.

Properties

Color BackgroundColor [get, set]
 Gets or sets the background color of the fill. The value is expressed as hex string with the format AARRGGBB. AA (Alpha) is usually FF. If set, the value will be cast to upper case.
Color ForegroundColor [get, set]
 Gets or sets the foreground color of the fill. The value is expressed as hex string with the format AARRGGBB. AA (Alpha) is usually FF. If set, the value will be bast to upper case.
PatternValue PatternFill [get, set]
 Gets or sets the pattern type of the fill (Default is none).
Properties inherited from NanoXLSX.Styles.AbstractStyle
int? InternalID [get, set]
 Gets or sets the internal ID for sorting purpose in the Excel style document (nullable).

Detailed Description

Class representing a Fill (background) entry. The Fill entry is used to define background colors and fill patterns.

Definition at line 19 of file Fill.cs.

Member Enumeration Documentation

◆ FillType

Enum for the type of the color, used by the Fill class.

Enumerator
PatternColor 

Color defines a pattern color.

FillColor 

Color defines a solid fill color.

Definition at line 41 of file Fill.cs.

◆ PatternValue

Enum for the pattern values, used by the Fill class.

Enumerator
None 

No pattern (default).

Remarks
The value none will lead to a invalidation of the foreground or background color values
Solid 

Solid fill (for colors).

DarkGray 

Dark gray fill.

MediumGray 

Medium gray fill.

LightGray 

Light gray fill.

Gray0625 

6.25% gray fill

Gray125 

12.5% gray fill

Definition at line 52 of file Fill.cs.

Constructor & Destructor Documentation

◆ Fill() [1/3]

NanoXLSX.Styles.Fill.Fill ( )

Default constructor.

Definition at line 127 of file Fill.cs.

◆ Fill() [2/3]

NanoXLSX.Styles.Fill.Fill ( string foreground,
string background )

Constructor with foreground and background color as sRGB values (without alpha).

Parameters
foregroundForeground color of the fill
backgroundBackground color of the fill

Definition at line 138 of file Fill.cs.

◆ Fill() [3/3]

NanoXLSX.Styles.Fill.Fill ( string value,
FillType fillType )

Constructor with color value as sRGB and fill type.

Parameters
valueColor value
fillTypeFill type (fill or pattern)

Definition at line 150 of file Fill.cs.

Member Function Documentation

◆ Copy()

override AbstractStyle NanoXLSX.Styles.Fill.Copy ( )

Method to copy the current object to a new one without casting.

Returns
Copy of the current object without the internal ID

Definition at line 188 of file Fill.cs.

◆ CopyFill()

Fill NanoXLSX.Styles.Fill.CopyFill ( )

Method to copy the current object to a new one with casting.

Returns
Copy of the current object without the internal ID

Definition at line 234 of file Fill.cs.

◆ Equals()

override bool NanoXLSX.Styles.Fill.Equals ( object obj)

Returns whether two instances are the same.

Parameters
objObject to compare
Returns
True if this instance and the other are the same

Definition at line 222 of file Fill.cs.

◆ GetHashCode()

override int NanoXLSX.Styles.Fill.GetHashCode ( )

Returns a hash code for this instance.

Returns
A hash code for this instance, suitable to be used in hashing algorithms and data structures like a hash table.

Definition at line 205 of file Fill.cs.

◆ operator Fill() [1/3]

implicit NanoXLSX.Styles.Fill.operator Fill ( IndexedColor.Value index)
static

Implicit operator to create a Fill object from an indexed color value (IndexedColor.Value) as foreground color with FillType.FillColor.

Parameters
indexColor index (0 to 65)

Definition at line 304 of file Fill.cs.

◆ operator Fill() [2/3]

implicit NanoXLSX.Styles.Fill.operator Fill ( int index)
static

Implicit operator to create a Fill object from an indexed color index (numeric) as foreground color with FillType.FillColor.

Parameters
indexColor index (0 to 65)

Definition at line 316 of file Fill.cs.

◆ operator Fill() [3/3]

implicit NanoXLSX.Styles.Fill.operator Fill ( string value)
static

Implicit operator to create a Fill object from a string (RGB or ARGB) as foreground color with FillType.FillColor.

Parameters
valueRGB/ARGB value

Definition at line 295 of file Fill.cs.

◆ SetColor() [1/3]

void NanoXLSX.Styles.Fill.SetColor ( Color value,
FillType fillType )

Sets the color depending on fill type, using a color object of the type Color.

Parameters
valuecolor value (compound object)
fillTypefill type (fill or pattern)

Definition at line 264 of file Fill.cs.

◆ SetColor() [2/3]

void NanoXLSX.Styles.Fill.SetColor ( IColor value,
FillType fillType )

Sets the color depending on fill type, using a color object, deriving from IColor.

Parameters
valuecolor value (component)
fillTypefill type (fill or pattern)

Definition at line 284 of file Fill.cs.

◆ SetColor() [3/3]

void NanoXLSX.Styles.Fill.SetColor ( string value,
FillType fillType )

Sets the color depending on fill type, using a sRGB value (without alpha).

Parameters
valuecolor value
fillTypefill type (fill or pattern)

Definition at line 244 of file Fill.cs.

◆ ToString()

override string NanoXLSX.Styles.Fill.ToString ( )

Override toString method.

Returns
String of a class

Definition at line 172 of file Fill.cs.

Member Data Documentation

◆ DefaultColor

readonly Color NanoXLSX.Styles.Fill.DefaultColor = Color.CreateRgb(SrgbColor.DefaultSrgbColor)
static

Default Color (foreground or background).

Definition at line 25 of file Fill.cs.

◆ DefaultIndexedColor

readonly Color NanoXLSX.Styles.Fill.DefaultIndexedColor = Color.CreateIndexed(IndexedColor.DefaultIndexedColor)
static

Default index color.

Definition at line 29 of file Fill.cs.

◆ DefaultPatternFill

readonly PatternValue NanoXLSX.Styles.Fill.DefaultPatternFill = PatternValue.None
static

Default pattern.

Definition at line 33 of file Fill.cs.

Property Documentation

◆ BackgroundColor

Color NanoXLSX.Styles.Fill.BackgroundColor
getset

Gets or sets the background color of the fill. The value is expressed as hex string with the format AARRGGBB. AA (Alpha) is usually FF. If set, the value will be cast to upper case.

Remarks
If a background color is set and the PatternFill Property is currently set to PatternValue.none, the PatternFill property will be automatically set to PatternValue.solid, since none invalidates the color values of the foreground or background

Definition at line 86 of file Fill.cs.

◆ ForegroundColor

Color NanoXLSX.Styles.Fill.ForegroundColor
getset

Gets or sets the foreground color of the fill. The value is expressed as hex string with the format AARRGGBB. AA (Alpha) is usually FF. If set, the value will be bast to upper case.

Remarks
If a foreground color is set and the PatternFill Property is currently set to PatternValue.none, the PatternFill property will be automatically set to PatternValue.solid, since none invalidates the color values of the foreground or background

Definition at line 104 of file Fill.cs.

◆ PatternFill

PatternValue NanoXLSX.Styles.Fill.PatternFill
getset

Gets or sets the pattern type of the fill (Default is none).

Definition at line 120 of file Fill.cs.


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