Represents the data cache for a PivotTable report.
When you create a pivot table, it doesn’t directly work with the source data. Instead, it uses an in-memory copy of the source data called the pivot cache. A workbook may contain multiple caches of different types. All PivotCache objects are stored in the PivotCacheCollection collection, which can be accessed using the Workbook.PivotCaches property. To return a pivot cache for a specific PivotTable report, use the PivotTable.Cache property.
By default, pivot tables that are based on the same data share a pivot cache. As a result, a certain functionality (such as grouping, calculated fields and items) used in one pivot table will be automatically propagated to other reports that share the same cache.
Since pivot tables work on a snapshot of data, any changes made to the actual data source will not affect the PivotTable reports. To get the latest data from the data source, refresh the pivot cache using the PivotCache.Refresh method. All the pivot tables that are based on this cache will be refreshed.
If you wish to create a new pivot table based on the data cache of the existing PivotTable report, use the PivotTableCollection.Add method overload that accepts a PivotCache object as a parameter. For an example, refer to the How to: Create a Pivot Table article.
Currently, the SpreadsheetControl can operate only with the pivot caches of the PivotCacheType.Worksheet and PivotCacheType.Consolidation types. A pivot cache with an external source is not supported.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the PivotCache interface.
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.