NanoXLSX.Core 3.0.0-rc.3
Loading...
Searching...
No Matches
NanoXLSX.Styles.Font Class Reference

Class representing a Font entry. The Font entry is used to define text formatting. More...

Inheritance diagram for NanoXLSX.Styles.Font:

Public Types

enum  SchemeValue { Major , Minor , None }
 Enum for the font scheme, used by the Font class. More...
enum  VerticalTextAlignValue { Subscript , Superscript , None }
 Enum for the vertical alignment of the text from baseline, used by the Font class. More...
enum  UnderlineValue {
  Single , Double , SingleAccounting , DoubleAccounting ,
  None
}
 Enum for the style of the underline property of a stylized text, used by the Font class. More...
enum  CharsetValue {
  ApplicationDefined = -1 , ANSI = 0 , Default = 1 , Symbols = 2 ,
  Macintosh = 77 , JIS = 128 , Hangul = 129 , Johab = 130 ,
  GBK = 134 , Big5 = 136 , Greek = 161 , Turkish = 162 ,
  Vietnamese = 163 , Hebrew = 177 , Arabic = 178 , Baltic = 186 ,
  Russian = 204 , Thai = 222 , EasternEuropean = 238 , OEM = 255
}
 Enum for the charset definitions of a font, used by the Font class. More...
enum  FontFamilyValue {
  NotApplicable = 0 , Roman = 1 , Swiss = 2 , Modern = 3 ,
  Script = 4 , Decorative = 5 , Reserved1 = 6 , Reserved2 = 7 ,
  Reserved3 = 8 , Reserved4 = 9 , Reserved5 = 10 , Reserved6 = 11 ,
  Reserved7 = 12 , Reserved8 = 13 , Reserved9 = 14
}
 Enum for the font family, according to the simple type definition of W3C. Used by the Font class. More...

Public Member Functions

 Font ()
 Default constructor.
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.
Font CopyFont ()
 Method to copy the current object to a new one with casting.
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 float MinFontSize = 1f
 Maximum possible font size.
static readonly float MaxFontSize = 409f
 Minimum possible font size.
static readonly float DefaultFontSize = 11f
 Default font size.
static readonly string DefaultMajorFont = "Calibri Light"
 The default font name that is declared as Major Font (See SchemeValue).
static readonly string DefaultMinorFont = "Calibri"
 The default font name that is declared as Minor Font (See SchemeValue).
static readonly string DefaultFontName = DefaultMinorFont
 Default font family as constant.
static readonly FontFamilyValue DefaultFontFamily = FontFamilyValue.Swiss
 Default font family.
static readonly SchemeValue DefaultFontScheme = SchemeValue.Minor
 Default font scheme.
static readonly VerticalTextAlignValue DefaultVerticalAlign = VerticalTextAlignValue.None
 Default vertical alignment.

Properties

bool Bold [get, set]
 Gets or sets whether the font is bold. If true, the font is declared as bold.
bool Italic [get, set]
 Gets or sets whether the font is italic. If true, the font is declared as italic.
bool Strike [get, set]
 Gets or sets whether the font is struck through. If true, the font is declared as strike-through.
UnderlineValue Underline = UnderlineValue.None [get, set]
 Gets or sets the underline style of the font. If set to none no underline will be applied (default).
CharsetValue Charset = CharsetValue.Default [get, set]
 Gets or sets the char set of the Font.
ColorSchemeElement ColorTheme [get, set]
 Gets or sets the font color theme, represented by a color scheme.
string ColorValue [get, set]
 Gets or sets the color code of the font color. 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 To omit the color, an empty string can be set. Empty is also default.
FontFamilyValue Family [get, set]
 Gets or sets the font family (Default is 2 = Swiss).
bool IsDefaultFont [get]
 Gets whether the font is equal to the default font.
string Name [get, set]
 Gets or sets the font name (Default is Calibri).
SchemeValue Scheme [get, set]
 Gets or sets the font scheme (Default is minor).
float Size [get, set]
 Gets or sets the font size. Valid range is from 1 to 409.
VerticalTextAlignValue VerticalAlign [get, set]
 Gets or sets the alignment of the font (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 Font entry. The Font entry is used to define text formatting.

Definition at line 19 of file Font.cs.

Member Enumeration Documentation

◆ CharsetValue

Enum for the charset definitions of a font, used by the Font class.

Enumerator
ApplicationDefined 

Application-defined (any other value than the defined enum values; can be ignored).

ANSI 

Charset according to iso-8859-1.

Default 

Default charset (not defined more specific).

Symbols 

Symbols from the private Unicode range U+FF00 to U+FFFF, to display special characters in the range of U+0000 to U+00FF.

Macintosh 

Macintosh charset, Standard Roman.

JIS 

Shift JIS charset (shift_jis).

Hangul 

Hangul charset (ks_c_5601-1987).

Johab 

Johab charset (KSC-5601-1992).

GBK 

GBK charset (GB-2312).

Big5 

Chinese Big Five charset.

Greek 

Greek charset (windows-1253).

Turkish 

Turkish charset (iso-8859-9).

Vietnamese 

Vietnamese charset (windows-1258).

Hebrew 

Hebrew charset (windows-1255).

Arabic 

Arabic charset (windows-1256).

Baltic 

Baltic charset (windows-1257).

Russian 

Russian charset (windows-1251).

Thai 

Thai charset (windows-874).

EasternEuropean 

Eastern Europe charset (windows-1250).

OEM 

OEM characters, not defined by ECMA-376.

Definition at line 116 of file Font.cs.

◆ FontFamilyValue

Enum for the font family, according to the simple type definition of W3C. Used by the Font class.

Enumerator
NotApplicable 

The family is not defined or not applicable.

Roman 

The specified font implements a Roman font.

Swiss 

The specified font implements a Swiss font.

Modern 

The specified font implements a Modern font.

Script 

The specified font implements a Script font.

Decorative 

The specified font implements a Decorative font.

Reserved1 

The specified font implements a not yet defined font archetype (reserved / do not use).

Reserved2 

The specified font implements a not yet defined font archetype (reserved / do not use).

Reserved3 

The specified font implements a not yet defined font archetype (reserved / do not use).

Reserved4 

The specified font implements a not yet defined font archetype (reserved / do not use).

Reserved5 

The specified font implements a not yet defined font archetype (reserved / do not use).

Reserved6 

The specified font implements a not yet defined font archetype (reserved / do not use).

Reserved7 

The specified font implements a not yet defined font archetype (reserved / do not use).

Reserved8 

The specified font implements a not yet defined font archetype (reserved / do not use).

Reserved9 

The specified font implements a not yet defined font archetype (reserved / do not use).

Definition at line 203 of file Font.cs.

◆ SchemeValue

Enum for the font scheme, used by the Font class.

Enumerator
Major 

Font scheme is major.

Minor 

Font scheme is minor (default).

None 

No Font scheme is used.

Definition at line 71 of file Font.cs.

◆ UnderlineValue

Enum for the style of the underline property of a stylized text, used by the Font class.

Enumerator
Single 

Text contains a single underline.

Double 

Text contains a double underline.

SingleAccounting 

Text contains a single, accounting underline.

DoubleAccounting 

Text contains a double, accounting underline.

None 

Text contains no underline (default).

Definition at line 97 of file Font.cs.

◆ VerticalTextAlignValue

Enum for the vertical alignment of the text from baseline, used by the Font class.

Enumerator
Subscript 

Text will be rendered as subscript.

Superscript 

Text will be rendered as superscript.

None 

Text will be rendered normal.

Definition at line 83 of file Font.cs.

Constructor & Destructor Documentation

◆ Font()

NanoXLSX.Styles.Font.Font ( )

Default constructor.

Definition at line 420 of file Font.cs.

Member Function Documentation

◆ Copy()

override AbstractStyle NanoXLSX.Styles.Font.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 486 of file Font.cs.

◆ CopyFont()

Font NanoXLSX.Styles.Font.CopyFont ( )

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 559 of file Font.cs.

◆ Equals()

override bool NanoXLSX.Styles.Font.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 538 of file Font.cs.

◆ GetHashCode()

override int NanoXLSX.Styles.Font.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 512 of file Font.cs.

◆ ToString()

override string NanoXLSX.Styles.Font.ToString ( )

Override toString method.

Returns
String of a class

Definition at line 461 of file Font.cs.

Member Data Documentation

◆ DefaultFontFamily

readonly FontFamilyValue NanoXLSX.Styles.Font.DefaultFontFamily = FontFamilyValue.Swiss
static

Default font family.

Definition at line 54 of file Font.cs.

◆ DefaultFontName

readonly string NanoXLSX.Styles.Font.DefaultFontName = DefaultMinorFont
static

Default font family as constant.

Definition at line 49 of file Font.cs.

◆ DefaultFontScheme

readonly SchemeValue NanoXLSX.Styles.Font.DefaultFontScheme = SchemeValue.Minor
static

Default font scheme.

Definition at line 59 of file Font.cs.

◆ DefaultFontSize

readonly float NanoXLSX.Styles.Font.DefaultFontSize = 11f
static

Default font size.

Definition at line 35 of file Font.cs.

◆ DefaultMajorFont

readonly string NanoXLSX.Styles.Font.DefaultMajorFont = "Calibri Light"
static

The default font name that is declared as Major Font (See SchemeValue).

Definition at line 40 of file Font.cs.

◆ DefaultMinorFont

readonly string NanoXLSX.Styles.Font.DefaultMinorFont = "Calibri"
static

The default font name that is declared as Minor Font (See SchemeValue).

Definition at line 44 of file Font.cs.

◆ DefaultVerticalAlign

readonly VerticalTextAlignValue NanoXLSX.Styles.Font.DefaultVerticalAlign = VerticalTextAlignValue.None
static

Default vertical alignment.

Definition at line 64 of file Font.cs.

◆ MaxFontSize

readonly float NanoXLSX.Styles.Font.MaxFontSize = 409f
static

Minimum possible font size.

Definition at line 30 of file Font.cs.

◆ MinFontSize

readonly float NanoXLSX.Styles.Font.MinFontSize = 1f
static

Maximum possible font size.

Definition at line 25 of file Font.cs.

Property Documentation

◆ Bold

bool NanoXLSX.Styles.Font.Bold
getset

Gets or sets whether the font is bold. If true, the font is declared as bold.

Definition at line 285 of file Font.cs.

◆ Charset

CharsetValue NanoXLSX.Styles.Font.Charset = CharsetValue.Default
getset

Gets or sets the char set of the Font.

Definition at line 308 of file Font.cs.

◆ ColorTheme

ColorSchemeElement NanoXLSX.Styles.Font.ColorTheme
getset

Gets or sets the font color theme, represented by a color scheme.

Definition at line 316 of file Font.cs.

◆ ColorValue

string NanoXLSX.Styles.Font.ColorValue
getset

Gets or sets the color code of the font color. 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 To omit the color, an empty string can be set. Empty is also default.

Exceptions
StyleExceptionThrows a StyleException if the passed ARGB value is not valid

Definition at line 334 of file Font.cs.

◆ Family

FontFamilyValue NanoXLSX.Styles.Font.Family
getset

Gets or sets the font family (Default is 2 = Swiss).

Definition at line 356 of file Font.cs.

◆ IsDefaultFont

bool NanoXLSX.Styles.Font.IsDefaultFont
get

Gets whether the font is equal to the default font.

Definition at line 361 of file Font.cs.

◆ Italic

bool NanoXLSX.Styles.Font.Italic
getset

Gets or sets whether the font is italic. If true, the font is declared as italic.

Definition at line 290 of file Font.cs.

◆ Name

string NanoXLSX.Styles.Font.Name
getset

Gets or sets the font name (Default is Calibri).

Exceptions
StyleExceptionA StyleException is thrown if the name is null or empty
Remarks
Note that the font name is not validated whether it is a valid or existing font. The font name may not exceed more than 31 characters

Definition at line 377 of file Font.cs.

◆ Scheme

SchemeValue NanoXLSX.Styles.Font.Scheme
getset

Gets or sets the font scheme (Default is minor).

Definition at line 390 of file Font.cs.

◆ Size

float NanoXLSX.Styles.Font.Size
getset

Gets or sets the font size. Valid range is from 1 to 409.

Definition at line 395 of file Font.cs.

◆ Strike

bool NanoXLSX.Styles.Font.Strike
getset

Gets or sets whether the font is struck through. If true, the font is declared as strike-through.

Definition at line 295 of file Font.cs.

◆ Underline

UnderlineValue NanoXLSX.Styles.Font.Underline = UnderlineValue.None
getset

Gets or sets the underline style of the font. If set to none no underline will be applied (default).

Definition at line 300 of file Font.cs.

◆ VerticalAlign

VerticalTextAlignValue NanoXLSX.Styles.Font.VerticalAlign
getset

Gets or sets the alignment of the font (Default is none).

Definition at line 412 of file Font.cs.


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