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.
get(string)Gets the PivotTable report by pivottable’s name.
get(number, number)Gets the PivotTable report by pivottable’s position.
dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
add(string, string, string)Adds a new PivotTable.
add(string, string, string, boolean)Adds a new PivotTable.
add(string, number, number, string)Adds a new PivotTable.
add(string, number, number, string, boolean)Adds a new PivotTable.
add(string, number, number, string, boolean, boolean)Adds a new PivotTable.
add(string, string, string, boolean, boolean)Adds a new PivotTable.
add(PivotTable, string, string)Adds a new PivotTable based on another PivotTable.
add(PivotTable, number, number, string)Adds a new PivotTable based on 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.
isNull()Checks whether the implementation object is null.

get(number)

Gets the PivotTable report by index.

get(index: number) : PivotTable;

Parameters:

ParameterTypeDescription
indexnumber

Returns

PivotTable

get(string)

Gets the PivotTable report by pivottable’s name.

get(name: string) : PivotTable;

Parameters:

ParameterTypeDescription
namestring

Returns

PivotTable

get(number, number)

Gets the PivotTable report by pivottable’s position.

get(row: number, column: number) : PivotTable;

Parameters:

ParameterTypeDescription
rownumber
columnnumber

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.

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.

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.

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.

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

Adds a new PivotTable.

add(sourceData: string, row: number, column: number, tableName: string, useSameSource: boolean, isXlsClassic: 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.
isXlsClassicbooleanIndicates whether add classic pivot table of Excel 97-2003.

Returns

The new added cache index.

add(string, string, string, boolean, boolean)

Adds a new PivotTable.

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

Parameters:

ParameterTypeDescription
sourceDatastringThe data cell range for the new PivotTable.Example : Sheet1!A1:C8
cellstringThe 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.
isXlsClassicbooleanIndicates whether add classic pivot table of Excel 97-2003.

Returns

The new added cache index.

add(PivotTable, string, string)

Adds a new PivotTable based on 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 based on 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;

isNull()

Checks whether the implementation object is null.

isNull() : boolean;