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
CellStyleXfs
Contain all named cell styles for the package
public ExcelStyleCollection<ExcelXfs> CellStyleXfs
Field Value
CellXfs
Contain all cell styles for the package
public ExcelStyleCollection<ExcelXfs> CellXfs
Field Value
Dxfs
Contain differential formatting styles for the package. This collection does not contain style records for slicers.
public ExcelStyleCollection<ExcelDxfStyleBase> Dxfs
Field Value
Fills
Contains all fill styles for the package
public ExcelStyleCollection<ExcelFillXml> Fills
Field Value
Fonts
Contains all font styles for the package
public ExcelStyleCollection<ExcelFontXml> Fonts
Field Value
NamedStyles
Contain all named styles for the package
public ExcelStyleCollection<ExcelNamedStyleXml> NamedStyles
Field Value
NumberFormats
Contains all numberformats for the package
public ExcelStyleCollection<ExcelNumberFormatXml> NumberFormats
Field Value
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
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
Methods
CreateNamedStyle(string)
Creates a named style that can be applied to cells in the worksheet.
public ExcelNamedStyleXml CreateNamedStyle(string name)
Parameters
name
stringThe 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
stringThe name of the style
Template
ExcelStyleA 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
stringThe 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
stringThe name of the style
templateStyle
ExcelTableNamedStyleBaseThe 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
stringThe name of the style
templateStyle
PivotTableStylesThe 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
stringThe 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
stringThe name of the style.
templateStyle
ExcelSlicerNamedStyleThe slicer style to us as template.
Returns
CreateSlicerStyle(string, eSlicerStyle)
Creates a custom slicer style.
public ExcelSlicerNamedStyle CreateSlicerStyle(string name, eSlicerStyle templateStyle)
Parameters
name
stringThe name of the style
templateStyle
eSlicerStyleThe 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
stringThe 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
stringThe name of the style
templateStyle
ExcelTableNamedStyleBaseThe 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
stringThe name of the style
templateStyle
PivotTableStylesThe 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
stringThe name of the style
templateStyle
TableStylesThe 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
stringThe 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
stringThe name of the style
templateStyle
ExcelTableNamedStyleBaseThe 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
stringThe name of the style
templateStyle
TableStylesThe 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()