Table of Contents

Class ExcelStyles

Namespace
OfficeOpenXml
Assembly
EPPlus.dll

Containts all shared cell styles for a workbook

public sealed class ExcelStyles : XmlHelper
Inheritance
ExcelStyles
Inherited Members

Fields

Borders

Contain all border styles for the package

public ExcelStyleCollection<ExcelBorderXml> Borders

Field Value

ExcelStyleCollection<ExcelBorderXml>

CellStyleXfs

Contain all named cell styles for the package

public ExcelStyleCollection<ExcelXfs> CellStyleXfs

Field Value

ExcelStyleCollection<ExcelXfs>

CellXfs

Contain all cell styles for the package

public ExcelStyleCollection<ExcelXfs> CellXfs

Field Value

ExcelStyleCollection<ExcelXfs>

Dxfs

Contain differential formatting styles for the package. This collection does not contain style records for slicers.

public ExcelStyleCollection<ExcelDxfStyleBase> Dxfs

Field Value

ExcelStyleCollection<ExcelDxfStyleBase>

Fills

Contains all fill styles for the package

public ExcelStyleCollection<ExcelFillXml> Fills

Field Value

ExcelStyleCollection<ExcelFillXml>

Fonts

Contains all font styles for the package

public ExcelStyleCollection<ExcelFontXml> Fonts

Field Value

ExcelStyleCollection<ExcelFontXml>

NamedStyles

Contain all named styles for the package

public ExcelStyleCollection<ExcelNamedStyleXml> NamedStyles

Field Value

ExcelStyleCollection<ExcelNamedStyleXml>

NumberFormats

Contains all numberformats for the package

public ExcelStyleCollection<ExcelNumberFormatXml> NumberFormats

Field Value

ExcelStyleCollection<ExcelNumberFormatXml>

SlicerStyles

Contain all slicer styles for the package. Tables styles can be used to customly format tables and pivot tables.

public ExcelNamedStyleCollection<ExcelSlicerNamedStyle> SlicerStyles

Field Value

ExcelNamedStyleCollection<ExcelSlicerNamedStyle>

TableStyles

Contain all table styles for the package. Tables styles can be used to customly format tables and pivot tables.

public ExcelNamedStyleCollection<ExcelTableNamedStyleBase> TableStyles

Field Value

ExcelNamedStyleCollection<ExcelTableNamedStyleBase>

Methods

CreateNamedStyle(string)

Creates a named style that can be applied to cells in the worksheet.

public ExcelNamedStyleXml CreateNamedStyle(string name)

Parameters

name string

The name of the style

Returns

ExcelNamedStyleXml

A named style object that can be custumized

CreateNamedStyle(string, ExcelStyle)

Creates a named style that can be applied to cells in the worksheet.

public ExcelNamedStyleXml CreateNamedStyle(string name, ExcelStyle Template)

Parameters

name string

The name of the style

Template ExcelStyle

A template style

Returns

ExcelNamedStyleXml

A named style object that can be custumized

CreatePivotTableStyle(string)

Creates a tables style only visible for pivot tables and with elements specific to pivot tables.

public ExcelPivotTableNamedStyle CreatePivotTableStyle(string name)

Parameters

name string

The name of the style

Returns

ExcelPivotTableNamedStyle

The table style object

CreatePivotTableStyle(string, ExcelTableNamedStyleBase)

Creates a tables style only visible for pivot tables and with elements specific to pivot tables.

public ExcelPivotTableNamedStyle CreatePivotTableStyle(string name, ExcelTableNamedStyleBase templateStyle)

Parameters

name string

The name of the style

templateStyle ExcelTableNamedStyleBase

The table style to use as a template for this custom style

Returns

ExcelPivotTableNamedStyle

The table style object

CreatePivotTableStyle(string, PivotTableStyles)

Creates a tables style only visible for pivot tables and with elements specific to pivot tables.

public ExcelPivotTableNamedStyle CreatePivotTableStyle(string name, PivotTableStyles templateStyle)

Parameters

name string

The name of the style

templateStyle PivotTableStyles

The built-in table style to use as a template for this custom style

Returns

ExcelPivotTableNamedStyle

The table style object

CreateSlicerStyle(string)

Creates a custom slicer style.

public ExcelSlicerNamedStyle CreateSlicerStyle(string name)

Parameters

name string

The name of the style

Returns

ExcelSlicerNamedStyle

The slicer style object

CreateSlicerStyle(string, ExcelSlicerNamedStyle)

Creates a custom named slicer style from another style.

public ExcelSlicerNamedStyle CreateSlicerStyle(string name, ExcelSlicerNamedStyle templateStyle)

Parameters

name string

The name of the style.

templateStyle ExcelSlicerNamedStyle

The slicer style to us as template.

Returns

ExcelSlicerNamedStyle

CreateSlicerStyle(string, eSlicerStyle)

Creates a custom slicer style.

public ExcelSlicerNamedStyle CreateSlicerStyle(string name, eSlicerStyle templateStyle)

Parameters

name string

The name of the style

templateStyle eSlicerStyle

The slicer style to use as a template for this custom style

Returns

ExcelSlicerNamedStyle

The slicer style object

CreateTableAndPivotTableStyle(string)

Creates a tables visible for tables and pivot tables and with elements for both.

public ExcelTableAndPivotTableNamedStyle CreateTableAndPivotTableStyle(string name)

Parameters

name string

The name of the style

Returns

ExcelTableAndPivotTableNamedStyle

The table style object

CreateTableAndPivotTableStyle(string, ExcelTableNamedStyleBase)

Creates a tables visible for tables and pivot tables and with elements for both.

public ExcelTableAndPivotTableNamedStyle CreateTableAndPivotTableStyle(string name, ExcelTableNamedStyleBase templateStyle)

Parameters

name string

The name of the style

templateStyle ExcelTableNamedStyleBase

The table style to use as a template for this custom style

Returns

ExcelTableAndPivotTableNamedStyle

The table style object

CreateTableAndPivotTableStyle(string, PivotTableStyles)

Creates a tables visible for tables and pivot tables and with elements for both.

public ExcelTableAndPivotTableNamedStyle CreateTableAndPivotTableStyle(string name, PivotTableStyles templateStyle)

Parameters

name string

The name of the style

templateStyle PivotTableStyles

The built-in pivot table style to use as a template for this custom style

Returns

ExcelTableAndPivotTableNamedStyle

The table style object

CreateTableAndPivotTableStyle(string, TableStyles)

Creates a tables visible for tables and pivot tables and with elements for both.

public ExcelTableAndPivotTableNamedStyle CreateTableAndPivotTableStyle(string name, TableStyles templateStyle)

Parameters

name string

The name of the style

templateStyle TableStyles

The built-in table style to use as a template for this custom style

Returns

ExcelTableAndPivotTableNamedStyle

The table style object

CreateTableStyle(string)

Creates a tables style only visible for tables and with elements specific to pivot tables.

public ExcelTableNamedStyle CreateTableStyle(string name)

Parameters

name string

The name of the style

Returns

ExcelTableNamedStyle

The table style object

CreateTableStyle(string, ExcelTableNamedStyleBase)

Creates a tables style only visible for tables and with elements specific to pivot tables.

public ExcelTableNamedStyle CreateTableStyle(string name, ExcelTableNamedStyleBase templateStyle)

Parameters

name string

The name of the style

templateStyle ExcelTableNamedStyleBase

The table style to use as a template for this custom style

Returns

ExcelTableNamedStyle

The table style object

CreateTableStyle(string, TableStyles)

Creates a tables style only visible for tables and with elements specific to pivot tables.

public ExcelTableNamedStyle CreateTableStyle(string name, TableStyles templateStyle)

Parameters

name string

The name of the style

templateStyle TableStyles

The built-in table style to use as a template for this custom style

Returns

ExcelTableNamedStyle

The table style object

UpdateXml()

Update the changes to the Style.Xml file inside the package. This will remove any unused styles from the collections.

public void UpdateXml()