|
NanoXLSX.Core 3.0.0-rc.3
|
Class representing a NumberFormat entry. The NumberFormat entry is used to define cell formats like currency or date. More...
Public Types | |
| enum | FormatNumber { None = 0 , Format1 = 1 , Format2 = 2 , Format3 = 3 , Format4 = 4 , Format5 = 5 , Format6 = 6 , Format7 = 7 , Format8 = 8 , Format9 = 9 , Format10 = 10 , Format11 = 11 , Format12 = 12 , Format13 = 13 , Format14 = 14 , Format15 = 15 , Format16 = 16 , Format17 = 17 , Format18 = 18 , Format19 = 19 , Format20 = 20 , Format21 = 21 , Format22 = 22 , Format37 = 37 , Format38 = 38 , Format39 = 39 , Format40 = 40 , Format45 = 45 , Format46 = 46 , Format47 = 47 , Format48 = 48 , Format49 = 49 , Custom = 164 } |
| Enum for predefined number formats, used by implementations of the NumberFormat class. More... | |
| enum | FormatRange { DefinedFormat , CustomFormat , Invalid , Undefined } |
| Range or validity of the format number, used by the NumberFormat class. More... | |
Public Member Functions | |
| NumberFormat () | |
| Default constructor. | |
| override string | ToString () |
| Override toString method. | |
| override AbstractStyle | Copy () |
| Method to copy the current object to a new one without casting. | |
| NumberFormat | CopyNumberFormat () |
| Method to copy the current object to a new one with casting. | |
| override int | GetHashCode () |
| Returns a hash code for this instance. | |
| override bool | Equals (object obj) |
| Returns whether two instances are the same. | |
| 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 bool | IsDateFormat (FormatNumber number) |
| Determines whether a defined style format number represents a date (or date and time). | |
| static bool | IsTimeFormat (FormatNumber number) |
| Determines whether a defined style format number represents a time). | |
| static FormatRange | TryParseFormatNumber (int number, out FormatNumber formatNumber) |
| Tries to parse registered format numbers. If the parsing fails, it is assumed that the number is a custom format number (164 or higher) and 'custom' is returned. | |
Static Public Attributes | |
| static readonly int | CustomFormatStartNumber = 164 |
| Start ID for custom number formats as constant (value 164). | |
| static readonly FormatNumber | DefaultNumber = FormatNumber.None |
| Default format number as constant. | |
Properties | |
| string | CustomFormatCode [get, set] |
| Gets or sets the raw custom format code in the notation of Excel. The code is not escaped or unescaped (on workbook loading). | |
| int | CustomFormatID [get, set] |
| Gets or sets the format number of the custom format. Must be higher or equal then predefined custom number (164). | |
| bool | IsCustomFormat [get] |
| Gets whether the number format is a custom format (higher or equals 164). If true, the format is custom. | |
| FormatNumber | Number [get, set] |
| Gets or sets the format number. Set this to custom (164) in case of custom number formats. | |
| 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). | |
Class representing a NumberFormat entry. The NumberFormat entry is used to define cell formats like currency or date.
Definition at line 17 of file NumberFormat.cs.
Enum for predefined number formats, used by implementations of the NumberFormat class.
| Enumerator | |
|---|---|
| None | No format / Default. |
| Format1 | Format: 0. |
| Format2 | Format: 0.00. |
| Format3 | Format: #,##0. |
| Format4 | Format: #,##0.00. |
| Format5 | Format: $#,##0_);($#,##0). |
| Format6 | Format: $#,##0_);Red. |
| Format7 | Format: $#,##0.00_);($#,##0.00). |
| Format8 | Format: $#,##0.00_);Red. |
| Format9 | Format: 0%. |
| Format10 | Format: 0.00%. |
| Format11 | Format: 0.00E+00. |
| Format12 | Format: # ?/? . |
| Format13 | Format: # ??/?? . |
| Format14 | Format: m/d/yyyy. |
| Format15 | Format: d-mmm-yy. |
| Format16 | Format: d-mmm. |
| Format17 | Format: mmm-yy. |
| Format18 | Format: mm AM/PM. |
| Format19 | Format: h:mm:ss AM/PM. |
| Format20 | Format: h:mm. |
| Format21 | Format: h:mm:ss. |
| Format22 | Format: m/d/yyyy h:mm. |
| Format37 | Format: #,##0_);(#,##0). |
| Format38 | Format: #,##0_);Red. |
| Format39 | Format: #,##0.00_);(#,##0.00). |
| Format40 | Format: #,##0.00_);Red. |
| Format45 | Format: mm:ss. |
| Format46 | Format: [h]:mm:ss. |
| Format47 | Format: mm:ss.0. |
| Format48 | Format: ##0.0E+0. |
| Format49 | Format: #. |
| Custom | Custom Format (ID 164 and higher). |
Definition at line 38 of file NumberFormat.cs.
Range or validity of the format number, used by the NumberFormat class.
Definition at line 111 of file NumberFormat.cs.
| NanoXLSX.Styles.NumberFormat.NumberFormat | ( | ) |
Default constructor.
Definition at line 198 of file NumberFormat.cs.
| override AbstractStyle NanoXLSX.Styles.NumberFormat.Copy | ( | ) |
Method to copy the current object to a new one without casting.
Definition at line 228 of file NumberFormat.cs.
| NumberFormat NanoXLSX.Styles.NumberFormat.CopyNumberFormat | ( | ) |
Method to copy the current object to a new one with casting.
Definition at line 243 of file NumberFormat.cs.
| override bool NanoXLSX.Styles.NumberFormat.Equals | ( | object | obj | ) |
Returns whether two instances are the same.
| obj | Object to compare |
Definition at line 271 of file NumberFormat.cs.
| override int NanoXLSX.Styles.NumberFormat.GetHashCode | ( | ) |
Returns a hash code for this instance.
Definition at line 254 of file NumberFormat.cs.
|
static |
Determines whether a defined style format number represents a date (or date and time).
| number | Format number to check |
Definition at line 289 of file NumberFormat.cs.
|
static |
Determines whether a defined style format number represents a time).
| number | Format number to check |
Definition at line 310 of file NumberFormat.cs.
| override string NanoXLSX.Styles.NumberFormat.ToString | ( | ) |
|
static |
Tries to parse registered format numbers. If the parsing fails, it is assumed that the number is a custom format number (164 or higher) and 'custom' is returned.
| number | Raw number to parse |
| formatNumber | Out parameter with the parsed format enum value. If parsing failed, 'custom' will be returned |
Definition at line 333 of file NumberFormat.cs.
|
static |
Start ID for custom number formats as constant (value 164).
Definition at line 23 of file NumberFormat.cs.
|
static |
Default format number as constant.
Definition at line 27 of file NumberFormat.cs.
|
getset |
Gets or sets the raw custom format code in the notation of Excel. The code is not escaped or unescaped (on workbook loading).
| NanoXLSX.Exceptions.FormatException | Throws a FormatException if passed value is null or empty |
Definition at line 145 of file NumberFormat.cs.
|
getset |
Gets or sets the format number of the custom format. Must be higher or equal then predefined custom number (164).
| NanoXLSX.Exceptions.StyleException | Throws a StyleException if the number is below the lowest possible custom number (164) |
Definition at line 162 of file NumberFormat.cs.
|
get |
Gets whether the number format is a custom format (higher or equals 164). If true, the format is custom.
Definition at line 178 of file NumberFormat.cs.
|
getset |
Gets or sets the format number. Set this to custom (164) in case of custom number formats.
Definition at line 191 of file NumberFormat.cs.