Table of Contents

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

IList<DifferentialStyleElement>

Styles

Main styles

public IList<StyleElement> Styles { get; }

Property Value

IList<StyleElement>

Methods

GetIndexByName(string)

Gets the index of a named style

public int GetIndexByName(string name)

Parameters

name string

The 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 string

The name of the style to look for.

styleElement StyleElement

A 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 string

The 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 string

The name of the differential style to look for.

differentialStyleElement DifferentialStyleElement

A 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 string

A unique name to find the inserted style later

font Font

Font

fill Fill

Fill

border Border

Border

numberingFormat NumberingFormat

NumberingFormat

alignment Alignment

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 Font

Font

fill Fill

Fill

border Border

Border

numberingFormat NumberingFormat

NumberingFormat

alignment Alignment

Alignment

name string

A 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 Font

Font

fill Fill

Fill

border Border

Border

numberingFormat NumberingFormat

NumberingFormat

name string

A 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 Alignment

Alignment

name string

A 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