8using System.Collections.Generic;
99#pragma warning disable CA1720
103#pragma warning restore CA1707
267 #region privateFields
344 [Append(Ignore =
true)]
366 ValidateFontScheme();
387 else { size = value; }
420 private void ValidateFontScheme()
446 StringBuilder sb =
new StringBuilder();
447 sb.Append(
"\"Font\": {\n");
448 AddPropertyAsJson(sb,
"Bold",
Bold);
449 AddPropertyAsJson(sb,
"Charset",
Charset);
450 AddPropertyAsJson(sb,
"ColorValue",
ColorValue);
452 AddPropertyAsJson(sb,
"Family",
Family);
453 AddPropertyAsJson(sb,
"Italic",
Italic);
454 AddPropertyAsJson(sb,
"Name",
Name);
455 AddPropertyAsJson(sb,
"Scheme",
Scheme);
456 AddPropertyAsJson(sb,
"Size",
Size);
457 AddPropertyAsJson(sb,
"Strike",
Strike);
458 AddPropertyAsJson(sb,
"Underline",
Underline);
459 AddPropertyAsJson(sb,
"Outline",
Outline);
460 AddPropertyAsJson(sb,
"Shadow",
Shadow);
461 AddPropertyAsJson(sb,
"Condense",
Condense);
462 AddPropertyAsJson(sb,
"Extend",
Extend);
463 AddPropertyAsJson(sb,
"HashCode", this.
GetHashCode(),
true);
465 return sb.ToString();
505 int hashCode = -924704582;
506 hashCode = hashCode * -1521134295 + size.GetHashCode();
507 hashCode = hashCode * -1521134295 +
Bold.GetHashCode();
508 hashCode = hashCode * -1521134295 +
Charset.GetHashCode();
509 hashCode = hashCode * -1521134295 + EqualityComparer<Color>.Default.GetHashCode(
ColorValue);
510 hashCode = hashCode * -1521134295 +
Family.GetHashCode();
511 hashCode = hashCode * -1521134295 +
Italic.GetHashCode();
512 hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(
Name);
513 hashCode = hashCode * -1521134295 +
Scheme.GetHashCode();
514 hashCode = hashCode * -1521134295 +
Strike.GetHashCode();
515 hashCode = hashCode * -1521134295 +
Underline.GetHashCode();
516 hashCode = hashCode * -1521134295 +
Outline.GetHashCode();
517 hashCode = hashCode * -1521134295 +
Shadow.GetHashCode();
518 hashCode = hashCode * -1521134295 +
Condense.GetHashCode();
519 hashCode = hashCode * -1521134295 +
Extend.GetHashCode();
520 hashCode = hashCode * -1521134295 +
VerticalAlign.GetHashCode();
532 return obj is
Font font &&
561 #region staticMethods
600 case UnderlineValue.SingleAccounting: output =
"singleAccounting";
break;
601 case UnderlineValue.DoubleAccounting: output =
"doubleAccounting";
break;
615 case "singleAccounting": output =
UnderlineValue.SingleAccounting;
break;
616 case "doubleAccounting": output =
UnderlineValue.DoubleAccounting;
break;
Compound class representing a color in various representations (RGB, indexed, theme,...
static Color CreateNone()
Creates an Color with no color (empty element).
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.
bool Outline
Gets or sets whether the font has an outline defined. If true, an outline is rendered around the text...
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.
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.
Color ColorValue
Gets or sets the color code of the font color. The value is an instance of Color To omit the color,...
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.
bool Extend
Gets or sets whether the font is rendered extended. If true, characters are placed more distant to ea...
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).
static readonly float MaxFontSize
Minimum possible font size.
bool Condense
Gets or sets whether the font is rendered condenses. If true, characters are placed closer to each ot...
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.
bool Shadow
Gets or sets whether the font has a drop shadow. If true, a shadow is rendered on the text.
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.