Show / Hide Table of Contents

Class ExcelPivotTableCollection

A collection of pivottable objects

Inheritance
object
ExcelPivotTableCollection
Implements
IEnumerable<ExcelPivotTable>
IEnumerable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: OfficeOpenXml.Table.PivotTable
Assembly: EPPlus.dll
Syntax
public class ExcelPivotTableCollection : IEnumerable<ExcelPivotTable>, IEnumerable

Properties

Count

Number of items in the collection

Declaration
public int Count { get; }
Property Value
Type Description
int

this[int]

The pivottable Index. Base 0.

Declaration
public ExcelPivotTable this[int Index] { get; }
Parameters
Type Name Description
int Index
Property Value
Type Description
ExcelPivotTable

this[string]

Pivottabes accesed by name

Declaration
public ExcelPivotTable this[string Name] { get; }
Parameters
Type Name Description
string Name

The name of the pivottable

Property Value
Type Description
ExcelPivotTable

The Pivotable. Null if the no match is found

Methods

Add(ExcelAddressBase, ExcelConnection, string, string[])

Create a pivot table with an external connection as source. Please note the EPPlus do not excute the connection query, so EPPlus will depend on the spread sheet application to calculate and render the pivot table.

Declaration
public ExcelPivotTable Add(ExcelAddressBase Range, ExcelConnection Connection, string Name, string[] Fields)
Parameters
Type Name Description
ExcelAddressBase Range

The range address including header and total row

ExcelConnection Connection

The connection to use as source.

string Name

The name of the pivottable. Must be unique

string[] Fields

Field names matching the output of the pivot table.

Returns
Type Description
ExcelPivotTable

The pivot table object

Add(ExcelAddressBase, ExcelRangeBase, string)

Create a pivottable on the supplied range

Declaration
public ExcelPivotTable Add(ExcelAddressBase Range, ExcelRangeBase Source, string Name)
Parameters
Type Name Description
ExcelAddressBase Range

The range address including header and total row

ExcelRangeBase Source

The Source data range address

string Name

The name of the pivottable. Must be unique

Returns
Type Description
ExcelPivotTable

The pivot table object

Add(ExcelAddressBase, ExcelTable, string)

Create a pivottable on the supplied range

Declaration
public ExcelPivotTable Add(ExcelAddressBase Range, ExcelTable Source, string Name)
Parameters
Type Name Description
ExcelAddressBase Range

The range address including header and total row

ExcelTable Source

The source table

string Name

The name of the pivottable. Must be unique

Returns
Type Description
ExcelPivotTable

The pivottable object

Add(ExcelAddressBase, ExcelPivotCacheDefinition, string)

Create a pivottable on the supplied range

Declaration
public ExcelPivotTable Add(ExcelAddressBase Range, ExcelPivotCacheDefinition PivotCacheDefinition, string Name)
Parameters
Type Name Description
ExcelAddressBase Range

The range address including header and total row

ExcelPivotCacheDefinition PivotCacheDefinition

A pivot table cache shared with another pivot table

string Name

The name of the pivottable. Must be unique

Returns
Type Description
ExcelPivotTable

The pivottable object

Calculate(bool)

Calculate all pivot tables in the collection. Also see Calculate(bool) and CalculateAllPivotTables(bool)

Declaration
public void Calculate(bool refresh = false)
Parameters
Type Name Description
bool refresh

If the cache should be refreshed.

Delete(ExcelPivotTable, bool)

Delete the supplied pivot table

Declaration
public void Delete(ExcelPivotTable PivotTable, bool ClearRange = false)
Parameters
Type Name Description
ExcelPivotTable PivotTable

The PivotTable to remove from the collection

bool ClearRange

Clear the table range

Delete(int, bool)

Delete the pivot table at the specified index

Declaration
public void Delete(int Index, bool ClearRange = false)
Parameters
Type Name Description
int Index

The index in the PivotTable collection

bool ClearRange

Clear the table range

Delete(string, bool)

Delete the pivottable with the supplied name

Declaration
public void Delete(string Name, bool ClearRange = false)
Parameters
Type Name Description
string Name

The name of the pivottable

bool ClearRange

Clear the table range

GetEnumerator()

Gets the enumerator of the collection

Declaration
public IEnumerator<ExcelPivotTable> GetEnumerator()
Returns
Type Description
IEnumerator<ExcelPivotTable>

The enumerator

Implements

IEnumerable<T>
IEnumerable
In this article
Back to top Generated by DocFX