PivotTableCollection

PivotTableCollection class

Represents the collection of all the PivotTable objects on the specified worksheet.

Properties

NameTypeDescription
Countint
Item (int)PivotTableGets the PivotTable report by index.
Item (java.lang.String)PivotTableGets the PivotTable report by pivottable’s name.
Item (int, int)PivotTableGets the PivotTable report by pivottable’s position.

Methods

NameDescription
disposePerforms application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
addAdds a new PivotTable cache to a PivotCaches collection.
clearClear all pivot tables.
removeDeletes the specified PivotTable and delete the PivotTable data
removeAtDeletes the PivotTable at the specified index and delete the PivotTable data
iterator
getReserved for internal use.
containsReserved for internal use.
indexOfReserved for internal use.

PivotTableCollection.Count property

Type: int

PivotTableCollection.Item (int) property

Gets the PivotTable report by index.

Type: PivotTable

PivotTableCollection.Item (java.lang.String) property

Gets the PivotTable report by pivottable’s name.

Type: PivotTable

PivotTableCollection.Item (int, int) property

Gets the PivotTable report by pivottable’s position.

Type: PivotTable

dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

add(sourceData, destCellName, tableName) (1 of 11)

Adds a new PivotTable cache to a PivotCaches collection.

ParameterTypeDescription
sourceDataStringThe data for the new PivotTable cache.
destCellNameStringThe cell in the upper-left corner of the PivotTable report’s destination range.
tableNameStringThe name of the new PivotTable report.

Returns: The new added cache index.


add(sourceData, destCellName, tableName, useSameSource) (2 of 11)

Adds a new PivotTable cache to a PivotCaches collection.

ParameterTypeDescription
sourceDataStringThe data for the new PivotTable cache.
destCellNameStringThe cell in the upper-left corner of the PivotTable report’s destination range.
tableNameStringThe name of the new PivotTable report.
useSameSourcebooleanIndicates whether using same data source when another existing pivot table has used this data source. If the property is true, it will save memory.

Returns: The new added cache index.


add(sourceData, row, column, tableName) (3 of 11)

Adds a new PivotTable cache to a PivotCaches collection.

ParameterTypeDescription
sourceDataStringThe data cell range for the new PivotTable.Example : Sheet1!A1:C8
rowintRow index of the cell in the upper-left corner of the PivotTable report’s destination range.
columnintColumn index of the cell in the upper-left corner of the PivotTable report’s destination range.
tableNameStringThe name of the new PivotTable report.

Returns: The new added cache index.


add(sourceData, row, column, tableName, useSameSource) (4 of 11)

Adds a new PivotTable cache to a PivotCaches collection.

ParameterTypeDescription
sourceDataStringThe data cell range for the new PivotTable.Example : Sheet1!A1:C8
rowintRow index of the cell in the upper-left corner of the PivotTable report’s destination range.
columnintColumn index of the cell in the upper-left corner of the PivotTable report’s destination range.
tableNameStringThe name of the new PivotTable report.
useSameSourcebooleanIndicates whether using same data source when another existing pivot table has used this data source. If the property is true, it will save memory.

Returns: The new added cache index.


add(sourceData, row, column, tableName, useSameSource, isXlsClassic) (5 of 11)


add(sourceData, cell, tableName, useSameSource, isXlsClassic) (6 of 11)


add(pivotTable, destCellName, tableName) (7 of 11)

Adds a new PivotTable Object to the collection from another PivotTable.

ParameterTypeDescription
pivotTablePivotTableThe source pivotTable.
destCellNameStringThe cell in the upper-left corner of the PivotTable report’s destination range.
tableNameStringThe name of the new PivotTable report.

Returns: The new added PivotTable index.


add(pivotTable, row, column, tableName) (8 of 11)

Adds a new PivotTable Object to the collection from another PivotTable.

ParameterTypeDescription
pivotTablePivotTableThe source pivotTable.
rowintRow index of the cell in the upper-left corner of the PivotTable report’s destination range.
columnintColumn index of the cell in the upper-left corner of the PivotTable report’s destination range.
tableNameStringThe name of the new PivotTable report.

Returns: The new added PivotTable index.


add(sourceData, isAutoPage, pageFields, destCellName, tableName) (9 of 11)

Adds a new PivotTable Object to the collection with multiple consolidation ranges as data source.

ParameterTypeDescription
sourceDataString[]The multiple consolidation ranges,such as {“Sheet1!A1:C8”,“Sheet2!A1:B8”}
isAutoPagebooleanWhether auto create a single page field. If true,the following param pageFields will be ignored.
pageFieldsPivotPageFieldsThe pivot page field items.
destCellNameStringdestCellName The name of the new PivotTable report.
tableNameStringthe name of the new PivotTable report.

Returns: The new added PivotTable index.


add(sourceData, isAutoPage, pageFields, row, column, tableName) (10 of 11)

Adds a new PivotTable Object to the collection with multiple consolidation ranges as data source.

ParameterTypeDescription
sourceDataString[]The multiple consolidation ranges,such as {“Sheet1!A1:C8”,“Sheet2!A1:B8”}
isAutoPagebooleanWhether auto create a single page field. If true,the following param pageFields will be ignored
pageFieldsPivotPageFieldsThe pivot page field items.
rowintRow index of the cell in the upper-left corner of the PivotTable report’s destination range.
columnintColumn index of the cell in the upper-left corner of the PivotTable report’s destination range.
tableNameStringThe name of the new PivotTable report.

Returns: The new added PivotTable index.


add(value) (11 of 11)

Reserved for internal use.

clear()

Clear all pivot tables.

remove(pivotTable) (1 of 2)

Deletes the specified PivotTable and delete the PivotTable data

ParameterTypeDescription
pivotTablePivotTablePivotTable object

remove(pivotTable, keepData) (2 of 2)

Deletes the specified PivotTable

ParameterTypeDescription
pivotTablePivotTablePivotTable object
keepDatabooleanWhether to keep the PivotTable data

removeAt(index) (1 of 2)

Deletes the PivotTable at the specified index and delete the PivotTable data

ParameterTypeDescription
indexintthe position index in PivotTable collection

removeAt(index, keepData) (2 of 2)

Deletes the PivotTable at the specified index

ParameterTypeDescription
indexintthe position index in PivotTable collection
keepDatabooleanWhether to keep the PivotTable data

iterator()

get(index)

Reserved for internal use.

contains(value)

Reserved for internal use.

indexOf(value)

Reserved for internal use.