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

Class representing a Style with sub classes within a style sheet. An instance of this class is only a container for the different sub-classes. These sub-classes contain the actual styling information. More...

Inheritance diagram for NanoXLSX.Styles.Style:

Public Member Functions

 Style ()
 Default constructor.
 Style (string name)
 Constructor with parameters.
 Style (string name, int forcedOrder, bool internalStyle)
 Constructor with parameters (internal use).
Style Append (AbstractStyle styleToAppend)
 Appends the specified style parts to the current one. The parts can be instances of sub-classes like Border or CellXf or a Style instance. Only the altered properties of the specified style or style part that differs from a new / untouched style instance will be appended. This enables method chaining.
override string ToString ()
 Override toString method.
override int GetHashCode ()
 Returns a hash code for this instance.
override AbstractStyle Copy ()
 Method to copy the current object to a new one without casting.
Style CopyStyle ()
 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.

Properties

Border CurrentBorder [get, set]
 Gets or sets the current Border object of the style.
CellXf CurrentCellXf [get, set]
 Gets or sets the current CellXf object of the style.
Fill CurrentFill [get, set]
 Gets or sets the current Fill object of the style.
Font CurrentFont [get, set]
 Gets or sets the current Font object of the style.
NumberFormat CurrentNumberFormat [get, set]
 Gets or sets the current NumberFormat object of the style.
string Name [get, set]
 Gets or sets the name of the informal style. If not defined, the automatically calculated hash will be used as name.
bool IsInternalStyle [get]
 Gets whether the style is system internal. Such styles are not meant to be altered.
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 Style with sub classes within a style sheet. An instance of this class is only a container for the different sub-classes. These sub-classes contain the actual styling information.

Definition at line 17 of file Style.cs.

Constructor & Destructor Documentation

◆ Style() [1/3]

NanoXLSX.Styles.Style.Style ( )

Default constructor.

Definition at line 71 of file Style.cs.

◆ Style() [2/3]

NanoXLSX.Styles.Style.Style ( string name)

Constructor with parameters.

Parameters
nameName of the style

Definition at line 85 of file Style.cs.

◆ Style() [3/3]

NanoXLSX.Styles.Style.Style ( string name,
int forcedOrder,
bool internalStyle )

Constructor with parameters (internal use).

Parameters
nameName of the style
forcedOrderNumber of the style for sorting purpose. The style will be placed at this position (internal use only)
internalStyleIf true, the style is marked as internal

Definition at line 101 of file Style.cs.

Member Function Documentation

◆ Append()

Style NanoXLSX.Styles.Style.Append ( AbstractStyle styleToAppend)

Appends the specified style parts to the current one. The parts can be instances of sub-classes like Border or CellXf or a Style instance. Only the altered properties of the specified style or style part that differs from a new / untouched style instance will be appended. This enables method chaining.

Parameters
styleToAppendThe style to append or a sub-class of Style
Returns
Current style with appended style parts

Definition at line 121 of file Style.cs.

◆ Copy()

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

◆ CopyStyle()

Style NanoXLSX.Styles.Style.CopyStyle ( )

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 227 of file Style.cs.

◆ GetHashCode()

override int NanoXLSX.Styles.Style.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.
Exceptions
StyleExceptionMissingReferenceException - The hash of the style could not be created because one or more components are missing as references

Definition at line 183 of file Style.cs.

◆ ToString()

override string NanoXLSX.Styles.Style.ToString ( )

Override toString method.

Returns
String of a class instance

Definition at line 162 of file Style.cs.

Property Documentation

◆ CurrentBorder

Border NanoXLSX.Styles.Style.CurrentBorder
getset

Gets or sets the current Border object of the style.

Definition at line 28 of file Style.cs.

◆ CurrentCellXf

CellXf NanoXLSX.Styles.Style.CurrentCellXf
getset

Gets or sets the current CellXf object of the style.

Definition at line 33 of file Style.cs.

◆ CurrentFill

Fill NanoXLSX.Styles.Style.CurrentFill
getset

Gets or sets the current Fill object of the style.

Definition at line 38 of file Style.cs.

◆ CurrentFont

Font NanoXLSX.Styles.Style.CurrentFont
getset

Gets or sets the current Font object of the style.

Definition at line 43 of file Style.cs.

◆ CurrentNumberFormat

NumberFormat NanoXLSX.Styles.Style.CurrentNumberFormat
getset

Gets or sets the current NumberFormat object of the style.

Definition at line 48 of file Style.cs.

◆ IsInternalStyle

bool NanoXLSX.Styles.Style.IsInternalStyle
get

Gets whether the style is system internal. Such styles are not meant to be altered.

Definition at line 60 of file Style.cs.

◆ Name

string NanoXLSX.Styles.Style.Name
getset

Gets or sets the name of the informal style. If not defined, the automatically calculated hash will be used as name.

Remarks
The name is informal and not considered as an identifier, when collecting all styles for a workbook

Definition at line 54 of file Style.cs.


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