Class StyleList
- Namespace
- BigExcelCreator.Styles
- Assembly
- BigExcelCreator.dll
Manages styles and generates stylesheets
public class StyleList
- Inheritance
-
StyleList
- Inherited Members
Constructors
StyleList()
Creates a style list and populates with default styles
public StyleList()
Properties
DifferentialStyleElements
Differential styles.
Used in COnditional formatting
public IList<DifferentialStyleElement> DifferentialStyleElements { get; }
Property Value
Styles
Main styles
public IList<StyleElement> Styles { get; }
Property Value
Methods
GetIndexByName(string)
Gets the index of a named style
public int GetIndexByName(string name)
Parameters
name
stringThe name of the style to look for.
Returns
- int
The index of the named style, or -1 if not found.
GetIndexByName(string, out StyleElement)
Gets the index of a named style.
public int GetIndexByName(string name, out StyleElement styleElement)
Parameters
name
stringThe name of the style to look for.
styleElement
StyleElementA copy of the found style.
Returns
- int
The index of the named style, or -1 if not found.
GetIndexDifferentialByName(string)
Gets the index of a named differential style.
public int GetIndexDifferentialByName(string name)
Parameters
name
stringThe name of the differential style to look for.
Returns
- int
The index of the named differential style, or -1 if not found.
GetIndexDifferentialByName(string, out DifferentialStyleElement)
Gets the index of a named differential style.
public int GetIndexDifferentialByName(string name, out DifferentialStyleElement differentialStyleElement)
Parameters
name
stringThe name of the differential style to look for.
differentialStyleElement
DifferentialStyleElementA copy of the found differential style.
Returns
- int
The index of the named differential style, or -1 if not found.
GetStylesheet()
Generates a Stylesheet to include in an Excel document
public Stylesheet GetStylesheet()
Returns
- Stylesheet
Stylesheet: A stylesheet
NewDifferentialStyle(string, Font, Fill, Border, NumberingFormat, Alignment)
Generates, stores and returns a new differential style
public DifferentialStyleElement NewDifferentialStyle(string name, Font font = null, Fill fill = null, Border border = null, NumberingFormat numberingFormat = null, Alignment alignment = null)
Parameters
name
stringA unique name to find the inserted style later
font
Fontfill
Fillborder
BordernumberingFormat
NumberingFormatalignment
Alignment
Returns
- DifferentialStyleElement
The DifferentialStyleElement generated
NewStyle(Font, Fill, Border, NumberingFormat, Alignment, string)
Generates, stores and returns a new style
public StyleElement NewStyle(Font font, Fill fill, Border border, NumberingFormat numberingFormat, Alignment alignment, string name)
Parameters
font
Fontfill
Fillborder
BordernumberingFormat
NumberingFormatalignment
Alignmentname
stringA unique name to find the inserted style later
Returns
- StyleElement
The StyleElement generated
NewStyle(Font, Fill, Border, NumberingFormat, string)
Generates, stores and returns a new style
public StyleElement NewStyle(Font font, Fill fill, Border border, NumberingFormat numberingFormat, string name)
Parameters
font
Fontfill
Fillborder
BordernumberingFormat
NumberingFormatname
stringA unique name to find the inserted style later
Returns
- StyleElement
The StyleElement generated
NewStyle(int?, int?, int?, int?, Alignment, string)
Generates, stores and returns a new style.
public StyleElement NewStyle(int? fontId, int? fillId, int? borderId, int? numberingFormatId, Alignment alignment, string name)
Parameters
fontId
int?Index of already inserted font
fillId
int?Index of already inserted fill
borderId
int?Index of already inserted border
numberingFormatId
int?Index of already inserted numbering format
alignment
Alignmentname
stringA unique name to find the inserted style later
Returns
- StyleElement
The StyleElement generated
Remarks
If the inserted indexes don't exist when the stylesheet is generated, the file might fail to open
To avoid such problems, use NewStyle(Font, Fill, Border, NumberingFormat, string) or NewStyle(Font, Fill, Border, NumberingFormat, Alignment, string) instead
This method should be private, but it's kept public for backwards compatibility reasons.
Exceptions
- ArgumentOutOfRangeException
Thrown when any of the provided indexes are less than 0