Show / Hide Table of Contents

Class ExcelStyles

Containts all shared cell styles for a workbook

Inheritance
System.Object
XmlHelper
ExcelStyles
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: OfficeOpenXml
Assembly: EPPlus.dll
Syntax
public sealed class ExcelStyles : XmlHelper

Fields

Borders

Contain all border styles for the package

Declaration
public ExcelStyleCollection<ExcelBorderXml> Borders
Field Value
Type Description
ExcelStyleCollection<ExcelBorderXml>

CellStyleXfs

Contain all named cell styles for the package

Declaration
public ExcelStyleCollection<ExcelXfs> CellStyleXfs
Field Value
Type Description
ExcelStyleCollection<ExcelXfs>

CellXfs

Contain all cell styles for the package

Declaration
public ExcelStyleCollection<ExcelXfs> CellXfs
Field Value
Type Description
ExcelStyleCollection<ExcelXfs>

Dxfs

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

Declaration
public ExcelStyleCollection<ExcelDxfStyleBase> Dxfs
Field Value
Type Description
ExcelStyleCollection<ExcelDxfStyleBase>

Fills

Contains all fill styles for the package

Declaration
public ExcelStyleCollection<ExcelFillXml> Fills
Field Value
Type Description
ExcelStyleCollection<ExcelFillXml>

Fonts

Contains all font styles for the package

Declaration
public ExcelStyleCollection<ExcelFontXml> Fonts
Field Value
Type Description
ExcelStyleCollection<ExcelFontXml>

NamedStyles

Contain all named styles for the package

Declaration
public ExcelStyleCollection<ExcelNamedStyleXml> NamedStyles
Field Value
Type Description
ExcelStyleCollection<ExcelNamedStyleXml>

NumberFormats

Contains all numberformats for the package

Declaration
public ExcelStyleCollection<ExcelNumberFormatXml> NumberFormats
Field Value
Type Description
ExcelStyleCollection<ExcelNumberFormatXml>

SlicerStyles

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

Declaration
public ExcelNamedStyleCollection<ExcelSlicerNamedStyle> SlicerStyles
Field Value
Type Description
ExcelNamedStyleCollection<ExcelSlicerNamedStyle>

TableStyles

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

Declaration
public ExcelNamedStyleCollection<ExcelTableNamedStyleBase> TableStyles
Field Value
Type Description
ExcelNamedStyleCollection<ExcelTableNamedStyleBase>

Methods

CreateNamedStyle(String)

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

Declaration
public ExcelNamedStyleXml CreateNamedStyle(string name)
Parameters
Type Name Description
System.String name

The name of the style

Returns
Type Description
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.

Declaration
public ExcelNamedStyleXml CreateNamedStyle(string name, ExcelStyle Template)
Parameters
Type Name Description
System.String name

The name of the style

ExcelStyle Template

A template style

Returns
Type Description
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.

Declaration
public ExcelPivotTableNamedStyle CreatePivotTableStyle(string name)
Parameters
Type Name Description
System.String name

The name of the style

Returns
Type Description
ExcelPivotTableNamedStyle

The table style object

CreatePivotTableStyle(String, ExcelTableNamedStyleBase)

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

Declaration
public ExcelPivotTableNamedStyle CreatePivotTableStyle(string name, ExcelTableNamedStyleBase templateStyle)
Parameters
Type Name Description
System.String name

The name of the style

ExcelTableNamedStyleBase templateStyle

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

Returns
Type Description
ExcelPivotTableNamedStyle

The table style object

CreatePivotTableStyle(String, PivotTableStyles)

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

Declaration
public ExcelPivotTableNamedStyle CreatePivotTableStyle(string name, PivotTableStyles templateStyle)
Parameters
Type Name Description
System.String name

The name of the style

PivotTableStyles templateStyle

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

Returns
Type Description
ExcelPivotTableNamedStyle

The table style object

CreateSlicerStyle(String)

Creates a custom slicer style.

Declaration
public ExcelSlicerNamedStyle CreateSlicerStyle(string name)
Parameters
Type Name Description
System.String name

The name of the style

Returns
Type Description
ExcelSlicerNamedStyle

The slicer style object

CreateSlicerStyle(String, ExcelSlicerNamedStyle)

Declaration
public ExcelSlicerNamedStyle CreateSlicerStyle(string name, ExcelSlicerNamedStyle templateStyle)
Parameters
Type Name Description
System.String name
ExcelSlicerNamedStyle templateStyle
Returns
Type Description
ExcelSlicerNamedStyle

CreateSlicerStyle(String, eSlicerStyle)

Creates a custom slicer style.

Declaration
public ExcelSlicerNamedStyle CreateSlicerStyle(string name, eSlicerStyle templateStyle)
Parameters
Type Name Description
System.String name

The name of the style

eSlicerStyle templateStyle

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

Returns
Type Description
ExcelSlicerNamedStyle

The slicer style object

CreateTableAndPivotTableStyle(String)

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

Declaration
public ExcelTableAndPivotTableNamedStyle CreateTableAndPivotTableStyle(string name)
Parameters
Type Name Description
System.String name

The name of the style

Returns
Type Description
ExcelTableAndPivotTableNamedStyle

The table style object

CreateTableAndPivotTableStyle(String, ExcelTableNamedStyleBase)

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

Declaration
public ExcelTableAndPivotTableNamedStyle CreateTableAndPivotTableStyle(string name, ExcelTableNamedStyleBase templateStyle)
Parameters
Type Name Description
System.String name

The name of the style

ExcelTableNamedStyleBase templateStyle

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

Returns
Type Description
ExcelTableAndPivotTableNamedStyle

The table style object

CreateTableAndPivotTableStyle(String, PivotTableStyles)

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

Declaration
public ExcelTableAndPivotTableNamedStyle CreateTableAndPivotTableStyle(string name, PivotTableStyles templateStyle)
Parameters
Type Name Description
System.String name

The name of the style

PivotTableStyles templateStyle

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

Returns
Type Description
ExcelTableAndPivotTableNamedStyle

The table style object

CreateTableAndPivotTableStyle(String, TableStyles)

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

Declaration
public ExcelTableAndPivotTableNamedStyle CreateTableAndPivotTableStyle(string name, TableStyles templateStyle)
Parameters
Type Name Description
System.String name

The name of the style

TableStyles templateStyle

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

Returns
Type Description
ExcelTableAndPivotTableNamedStyle

The table style object

CreateTableStyle(String)

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

Declaration
public ExcelTableNamedStyle CreateTableStyle(string name)
Parameters
Type Name Description
System.String name

The name of the style

Returns
Type Description
ExcelTableNamedStyle

The table style object

CreateTableStyle(String, ExcelTableNamedStyleBase)

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

Declaration
public ExcelTableNamedStyle CreateTableStyle(string name, ExcelTableNamedStyleBase templateStyle)
Parameters
Type Name Description
System.String name

The name of the style

ExcelTableNamedStyleBase templateStyle

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

Returns
Type Description
ExcelTableNamedStyle

The table style object

CreateTableStyle(String, TableStyles)

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

Declaration
public ExcelTableNamedStyle CreateTableStyle(string name, TableStyles templateStyle)
Parameters
Type Name Description
System.String name

The name of the style

TableStyles templateStyle

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

Returns
Type Description
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.

Declaration
public void UpdateXml()
In This Article
Back to top Generated by DocFX