8using System.Collections.Generic;
100#pragma warning disable CA1720
104#pragma warning restore CA1707
268 #region privateFields
273 private string colorValue =
"";
274 private ColorSchemeElement colorTheme;
360 [Append(Ignore =
true)]
383 ValidateFontScheme();
404 else { size = value; }
437 private void ValidateFontScheme()
463 StringBuilder sb =
new StringBuilder();
464 sb.Append(
"\"Font\": {\n");
465 AddPropertyAsJson(sb,
"Bold",
Bold);
466 AddPropertyAsJson(sb,
"Charset",
Charset);
467 AddPropertyAsJson(sb,
"ColorTheme",
ColorTheme);
468 AddPropertyAsJson(sb,
"ColorValue",
ColorValue);
470 AddPropertyAsJson(sb,
"Family",
Family);
471 AddPropertyAsJson(sb,
"Italic",
Italic);
472 AddPropertyAsJson(sb,
"Name",
Name);
473 AddPropertyAsJson(sb,
"Scheme",
Scheme);
474 AddPropertyAsJson(sb,
"Size",
Size);
475 AddPropertyAsJson(sb,
"Strike",
Strike);
476 AddPropertyAsJson(sb,
"Underline",
Underline);
477 AddPropertyAsJson(sb,
"HashCode", this.
GetHashCode(),
true);
479 return sb.ToString();
516 int hashCode = -924704582;
517 hashCode = hashCode * -1521134295 + size.GetHashCode();
518 hashCode = hashCode * -1521134295 +
Bold.GetHashCode();
519 hashCode = hashCode * -1521134295 +
Charset.GetHashCode();
520 hashCode = hashCode * -1521134295 +
ColorTheme.GetHashCode();
521 hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(
ColorValue);
522 hashCode = hashCode * -1521134295 +
Family.GetHashCode();
523 hashCode = hashCode * -1521134295 +
Italic.GetHashCode();
524 hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(
Name);
525 hashCode = hashCode * -1521134295 +
Scheme.GetHashCode();
526 hashCode = hashCode * -1521134295 +
Strike.GetHashCode();
527 hashCode = hashCode * -1521134295 +
Underline.GetHashCode();
528 hashCode = hashCode * -1521134295 +
VerticalAlign.GetHashCode();
540 return obj is
Font font &&
566 #region staticMethods
605 case UnderlineValue.SingleAccounting: output =
"singleAccounting";
break;
606 case UnderlineValue.DoubleAccounting: output =
"doubleAccounting";
break;
620 case "singleAccounting": output =
UnderlineValue.SingleAccounting;
break;
621 case "doubleAccounting": output =
UnderlineValue.DoubleAccounting;
break;
Class for exceptions regarding Style incidents.
Class represents an abstract style component.
CharsetValue Charset
Gets or sets the char set of the Font.
VerticalTextAlignValue
Enum for the vertical alignment of the text from baseline, used by the Font class.
@ Superscript
Text will be rendered as superscript.
@ Subscript
Text will be rendered as subscript.
SchemeValue
Enum for the font scheme, used by the Font class.
@ Major
Font scheme is major.
@ None
No Font scheme is used.
@ Minor
Font scheme is minor (default).
bool Bold
Gets or sets whether the font is bold. If true, the font is declared as bold.
override bool Equals(object obj)
Returns whether two instances are the same.
static readonly float MinFontSize
Maximum possible font size.
static readonly VerticalTextAlignValue DefaultVerticalAlign
Default vertical alignment.
static readonly string DefaultMajorFont
The default font name that is declared as Major Font (See SchemeValue).
static readonly float DefaultFontSize
Default font size.
static readonly string DefaultFontName
Default font family as constant.
static readonly FontFamilyValue DefaultFontFamily
Default font family.
ColorSchemeElement ColorTheme
Gets or sets the font color theme, represented by a color scheme.
Font CopyFont()
Method to copy the current object to a new one with casting.
override AbstractStyle Copy()
Method to copy the current object to a new one without casting.
bool IsDefaultFont
Gets whether the font is equal to the default font.
bool Italic
Gets or sets whether the font is italic. If true, the font is declared as italic.
VerticalTextAlignValue VerticalAlign
Gets or sets the alignment of the font (Default is none).
SchemeValue Scheme
Gets or sets the font scheme (Default is minor).
static readonly SchemeValue DefaultFontScheme
Default font scheme.
UnderlineValue Underline
Gets or sets the underline style of the font. If set to none no underline will be applied (default).
bool Strike
Gets or sets whether the font is struck through. If true, the font is declared as strike-through.
static readonly string DefaultMinorFont
The default font name that is declared as Minor Font (See SchemeValue).
string ColorValue
Gets or sets the color code of the font color. The value is expressed as hex string with the format A...
static readonly float MaxFontSize
Minimum possible font size.
float Size
Gets or sets the font size. Valid range is from 1 to 409.
string Name
Gets or sets the font name (Default is Calibri).
override int GetHashCode()
Returns a hash code for this instance.
FontFamilyValue Family
Gets or sets the font family (Default is 2 = Swiss).
Font()
Default constructor.
FontFamilyValue
Enum for the font family, according to the simple type definition of W3C. Used by the Font class.
@ Swiss
The specified font implements a Swiss font.
@ Reserved5
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).
@ Reserved9
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).
@ NotApplicable
The family is not defined or not applicable.
@ Reserved1
The specified font implements a not yet defined font archetype (reserved / do not use).
@ Modern
The specified font implements a Modern font.
@ Reserved3
The specified font implements a not yet defined font archetype (reserved / do not use).
@ Roman
The specified font implements a Roman font.
@ Decorative
The specified font implements a Decorative font.
@ Reserved2
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).
@ Reserved8
The specified font implements a not yet defined font archetype (reserved / do not use).
@ Script
The specified font implements a Script font.
override string ToString()
Override toString method.
UnderlineValue
Enum for the style of the underline property of a stylized text, used by the Font class.
@ Single
Text contains a single underline.
@ SingleAccounting
Text contains a single, accounting underline.
@ DoubleAccounting
Text contains a double, accounting underline.
@ Double
Text contains a double underline.
CharsetValue
Enum for the charset definitions of a font, used by the Font class.
@ JIS
Shift JIS charset (shift_jis).
@ Greek
Greek charset (windows-1253).
@ Big5
Chinese Big Five charset.
@ Arabic
Arabic charset (windows-1256).
@ Thai
Thai charset (windows-874).
@ OEM
OEM characters, not defined by ECMA-376.
@ Symbols
Symbols from the private Unicode range U+FF00 to U+FFFF, to display special characters in the range o...
@ Hangul
Hangul charset (ks_c_5601-1987).
@ Default
Default charset (not defined more specific).
@ Vietnamese
Vietnamese charset (windows-1258).
@ EasternEuropean
Eastern Europe charset (windows-1250).
@ GBK
GBK charset (GB-2312).
@ Turkish
Turkish charset (iso-8859-9).
@ Macintosh
Macintosh charset, Standard Roman.
@ Hebrew
Hebrew charset (windows-1255).
@ ANSI
Charset according to iso-8859-1.
@ Johab
Johab charset (KSC-5601-1992).
@ Russian
Russian charset (windows-1251).
@ Baltic
Baltic charset (windows-1257).
@ ApplicationDefined
Application-defined (any other value than the defined enum values; can be ignored).
Class to manage all styles at runtime, before writing XLSX files. The main purpose is deduplication a...
static StyleRepository Instance
Gets the singleton instance of the repository.
Class representing an Office theme.
Class providing static methods to parse string values to specific types or to print object as languag...
static string ToUpper(string input)
Transforms a string to upper case with null check and invariant culture.
Class providing general validator methods.
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 or Fo...