Class ExcelStyles
Containts all shared cell styles for a workbook
Inherited Members
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 |
---|---|
Excel |
CellStyleXfs
Contain all named cell styles for the package
Declaration
public ExcelStyleCollection<ExcelXfs> CellStyleXfs
Field Value
Type | Description |
---|---|
Excel |
CellXfs
Contain all cell styles for the package
Declaration
public ExcelStyleCollection<ExcelXfs> CellXfs
Field Value
Type | Description |
---|---|
Excel |
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 |
---|---|
Excel |
Fills
Contains all fill styles for the package
Declaration
public ExcelStyleCollection<ExcelFillXml> Fills
Field Value
Type | Description |
---|---|
Excel |
Fonts
Contains all font styles for the package
Declaration
public ExcelStyleCollection<ExcelFontXml> Fonts
Field Value
Type | Description |
---|---|
Excel |
NamedStyles
Contain all named styles for the package
Declaration
public ExcelStyleCollection<ExcelNamedStyleXml> NamedStyles
Field Value
Type | Description |
---|---|
Excel |
NumberFormats
Contains all numberformats for the package
Declaration
public ExcelStyleCollection<ExcelNumberFormatXml> NumberFormats
Field Value
Type | Description |
---|---|
Excel |
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 |
---|---|
Excel |
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 |
---|---|
Excel |
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. |
name | The name of the style |
Returns
Type | Description |
---|---|
Excel |
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. |
name | The name of the style |
Excel |
Template | A template style |
Returns
Type | Description |
---|---|
Excel |
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. |
name | The name of the style |
Returns
Type | Description |
---|---|
Excel |
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. |
name | The name of the style |
Excel |
templateStyle | The table style to use as a template for this custom style |
Returns
Type | Description |
---|---|
Excel |
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. |
name | The name of the style |
Pivot |
templateStyle | The built-in table style to use as a template for this custom style |
Returns
Type | Description |
---|---|
Excel |
The table style object |
CreateSlicerStyle(String)
Creates a custom slicer style.
Declaration
public ExcelSlicerNamedStyle CreateSlicerStyle(string name)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | The name of the style |
Returns
Type | Description |
---|---|
Excel |
The slicer style object |
CreateSlicerStyle(String, ExcelSlicerNamedStyle)
Declaration
public ExcelSlicerNamedStyle CreateSlicerStyle(string name, ExcelSlicerNamedStyle templateStyle)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | |
Excel |
templateStyle |
Returns
Type | Description |
---|---|
Excel |
CreateSlicerStyle(String, eSlicerStyle)
Creates a custom slicer style.
Declaration
public ExcelSlicerNamedStyle CreateSlicerStyle(string name, eSlicerStyle templateStyle)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | The name of the style |
e |
templateStyle | The slicer style to use as a template for this custom style |
Returns
Type | Description |
---|---|
Excel |
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. |
name | The name of the style |
Returns
Type | Description |
---|---|
Excel |
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. |
name | The name of the style |
Excel |
templateStyle | The table style to use as a template for this custom style |
Returns
Type | Description |
---|---|
Excel |
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. |
name | The name of the style |
Pivot |
templateStyle | The built-in pivot table style to use as a template for this custom style |
Returns
Type | Description |
---|---|
Excel |
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. |
name | The name of the style |
Table |
templateStyle | The built-in table style to use as a template for this custom style |
Returns
Type | Description |
---|---|
Excel |
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. |
name | The name of the style |
Returns
Type | Description |
---|---|
Excel |
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. |
name | The name of the style |
Excel |
templateStyle | The table style to use as a template for this custom style |
Returns
Type | Description |
---|---|
Excel |
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. |
name | The name of the style |
Table |
templateStyle | The built-in table style to use as a template for this custom style |
Returns
Type | Description |
---|---|
Excel |
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()