PivotTableCollection

PivotTableCollection class

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

class PivotTableCollection;

Methods

MethodDescription
get(number)Gets the PivotTable report by index.
dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
add(string, string, string)Adds a new PivotTable cache to a PivotCaches collection.
add(string, string, string, boolean)Adds a new PivotTable cache to a PivotCaches collection.
add(string, number, number, string)Adds a new PivotTable cache to a PivotCaches collection.
add(string, number, number, string, boolean)Adds a new PivotTable cache to a PivotCaches collection.
add(PivotTable, string, string)Adds a new PivotTable Object to the collection from another PivotTable.
add(PivotTable, number, number, string)Adds a new PivotTable Object to the collection from another PivotTable.
add(string[], boolean, PivotPageFields, string, string)Adds a new PivotTable Object to the collection with multiple consolidation ranges as data source.
add(string[], boolean, PivotPageFields, number, number, string)Adds a new PivotTable Object to the collection with multiple consolidation ranges as data source.
clear()Clear all pivot tables.
remove(PivotTable)Deletes the specified PivotTable and delete the PivotTable data
remove(PivotTable, boolean)Deletes the specified PivotTable
removeAt(number)Deletes the PivotTable at the specified index and delete the PivotTable data
removeAt(number, boolean)Deletes the PivotTable at the specified index
getCount()Gets the number of elements contained in.

get(number)

Gets the PivotTable report by index.

get(index: number) : PivotTable;

Parameters:

ParameterTypeDescription
indexnumber

Returns

PivotTable

dispose()

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

dispose() : void;

add(string, string, string)

Adds a new PivotTable cache to a PivotCaches collection.

add(sourceData: string, destCellName: string, tableName: string) : number;

Parameters:

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(string, string, string, boolean)

Adds a new PivotTable cache to a PivotCaches collection.

add(sourceData: string, destCellName: string, tableName: string, useSameSource: boolean) : number;

Parameters:

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(string, number, number, string)

Adds a new PivotTable cache to a PivotCaches collection.

add(sourceData: string, row: number, column: number, tableName: string) : number;

Parameters:

ParameterTypeDescription
sourceDatastringThe data cell range for the new PivotTable.Example : Sheet1!A1:C8
rownumberRow index of the cell in the upper-left corner of the PivotTable report’s destination range.
columnnumberColumn 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(string, number, number, string, boolean)

Adds a new PivotTable cache to a PivotCaches collection.

add(sourceData: string, row: number, column: number, tableName: string, useSameSource: boolean) : number;

Parameters:

ParameterTypeDescription
sourceDatastringThe data cell range for the new PivotTable.Example : Sheet1!A1:C8
rownumberRow index of the cell in the upper-left corner of the PivotTable report’s destination range.
columnnumberColumn 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(PivotTable, string, string)

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

add(pivotTable: PivotTable, destCellName: string, tableName: string) : number;

Parameters:

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, number, number, string)

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

add(pivotTable: PivotTable, row: number, column: number, tableName: string) : number;

Parameters:

ParameterTypeDescription
pivotTablePivotTableThe source pivotTable.
rownumberRow index of the cell in the upper-left corner of the PivotTable report’s destination range.
columnnumberColumn 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(string[], boolean, PivotPageFields, string, string)

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

add(sourceData: string[], isAutoPage: boolean, pageFields: PivotPageFields, destCellName: string, tableName: string) : number;

Parameters:

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(string[], boolean, PivotPageFields, number, number, string)

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

add(sourceData: string[], isAutoPage: boolean, pageFields: PivotPageFields, row: number, column: number, tableName: string) : number;

Parameters:

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.
rownumberRow index of the cell in the upper-left corner of the PivotTable report’s destination range.
columnnumberColumn 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.

clear()

Clear all pivot tables.

clear() : void;

remove(PivotTable)

Deletes the specified PivotTable and delete the PivotTable data

remove(pivotTable: PivotTable) : void;

Parameters:

ParameterTypeDescription
pivotTablePivotTablePivotTable object

remove(PivotTable, boolean)

Deletes the specified PivotTable

remove(pivotTable: PivotTable, keepData: boolean) : void;

Parameters:

ParameterTypeDescription
pivotTablePivotTablePivotTable object
keepDatabooleanWhether to keep the PivotTable data

removeAt(number)

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

removeAt(index: number) : void;

Parameters:

ParameterTypeDescription
indexnumberthe position index in PivotTable collection

removeAt(number, boolean)

Deletes the PivotTable at the specified index

removeAt(index: number, keepData: boolean) : void;

Parameters:

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

getCount()

Gets the number of elements contained in.

getCount() : number;