[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotCache

IPivotCache Interface

Represents the memory cache for a PivotTable report.

An IPivotCache stores the source data used by one or more PivotTable reports. You can create a cache from a range or table through Create(object), inspect its source data and refresh settings, and create a PivotTable from the cache by calling CreatePivotTable(IRange, string) or CreatePivotTable(IRange, string).

Namespace: GrapeCity.Documents.Excel
Assembly: DS.Documents.Excel.dll
Syntax
public interface IPivotCache
Public Interface IPivotCache
Examples
worksheet.Range["A1:C4"].Value = new object[,] {
    {"Product", "Category", "Amount"},
    {"Carrots", "Vegetables", 1200},
    {"Broccoli", "Vegetables", 850},
    {"Bananas", "Fruit", 640}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:C4"]);
pivotCache.CreatePivotTable(worksheet.Range["E1"]);

Properties

Name Description
Index

Gets the index number of this PivotCache within the collection of objects.

RecordCount

Gets the number of records in the PivotTable cache.

This value reflects the number of source records currently stored in the cache.

RefreshDate

Gets the date on which the PivotTable cache was last refreshed.

RefreshName

Gets the name of the person who last refreshed the PivotTable cache.

Use this property to retrieve the refresh user recorded in the cache metadata.

RefreshOnFileOpen

Gets or sets a value indicating whether the PivotTable cache is automatically updated each time the workbook is opened.

The default value is false.

SourceData

Gets or sets the data source for the PivotTable report.

Methods

Name Description
CreatePivotTable(IRange, string)

Creates a new IPivotTable report from this pivot cache at the specified destination.

The pivot table is created on the worksheet that contains TableDestination. TableDestination specifies the upper-left cell of the destination area where the resulting pivot table will be placed.

Refresh()

Updates the PivotTable cache from its source data.

Use this method after changing the cache source range to reload the cached records used by PivotTable reports that are based on this IPivotCache.