NanoXLSX.Core 3.0.0-rc.3
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.
 Fill (string value, FillType fillType)
 Constructor with color value 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 and the depending on fill type.
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 Attributes

static readonly string DefaultColor = "FF000000"
 Default Color (foreground or background).
static readonly int DefaultIndexedColor = 64
 Default index color.
static readonly PatternValue DefaultPatternFill = PatternValue.None
 Default pattern.

Properties

string 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.
string 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.
int IndexedColor [get, set]
 Gets or sets the indexed color (Default is 64).
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 17 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 39 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 49 of file Fill.cs.

Constructor & Destructor Documentation

◆ Fill() [1/3]

NanoXLSX.Styles.Fill.Fill ( )

Default constructor.

Definition at line 131 of file Fill.cs.

◆ Fill() [2/3]

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

Constructor with foreground and background color.

Parameters
foregroundForeground color of the fill
backgroundBackground color of the fill

Definition at line 143 of file Fill.cs.

◆ Fill() [3/3]

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

Constructor with color value and fill type.

Parameters
valueColor value
fillTypeFill type (fill or pattern)

Definition at line 156 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 196 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 245 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 232 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 214 of file Fill.cs.

◆ SetColor()

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

Sets the color and the depending on fill type.

Parameters
valuecolor value
fillTypefill type (fill or pattern)

Definition at line 255 of file Fill.cs.

◆ ToString()

override string NanoXLSX.Styles.Fill.ToString ( )

Override toString method.

Returns
String of a class

Definition at line 179 of file Fill.cs.

Member Data Documentation

◆ DefaultColor

readonly string NanoXLSX.Styles.Fill.DefaultColor = "FF000000"
static

Default Color (foreground or background).

Definition at line 23 of file Fill.cs.

◆ DefaultIndexedColor

readonly int NanoXLSX.Styles.Fill.DefaultIndexedColor = 64
static

Default index color.

Definition at line 27 of file Fill.cs.

◆ DefaultPatternFill

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

Default pattern.

Definition at line 31 of file Fill.cs.

Property Documentation

◆ BackgroundColor

string 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 83 of file Fill.cs.

◆ ForegroundColor

string 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 102 of file Fill.cs.

◆ IndexedColor

int NanoXLSX.Styles.Fill.IndexedColor
getset

Gets or sets the indexed color (Default is 64).

Definition at line 119 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 124 of file Fill.cs.


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