Class PivotCacheCollection
Represents the collection of memory caches from the PivotTable reports in a workbook.
Inherited Members
Namespace: Syncfusion.XlsIO.Implementation.PivotTables
Assembly: Syncfusion.XlsIO.NET.dll
Syntax
public class PivotCacheCollection : ICloneParent, IPivotCaches, IEnumerable<PivotCacheImpl>, IEnumerable, IParentApplication
Constructors
PivotCacheCollection(IApplication, object)
Initializes a new instance of pivot cache collection.
Declaration
public PivotCacheCollection(IApplication application, object parent)
Parameters
| Type | Name | Description |
|---|---|---|
| IApplication | application | Application object that represents the Excel application. |
| object | parent | Parent object of this collection. |
PivotCacheCollection(IApplication, object, ICompoundStorage, IDecryptor)
Initializes a new instance of pivot cache collection with the specified cache storage and dectyptor.
Declaration
public PivotCacheCollection(IApplication application, object parent, ICompoundStorage storage, IDecryptor decryptor)
Parameters
| Type | Name | Description |
|---|---|---|
| IApplication | application | Application object that represents the Excel application. |
| object | parent | Parent object of this collection. |
| ICompoundStorage | storage | Pivot caches storage. |
| IDecryptor | decryptor | Object used to decrypt encrypted records. |
Fields
DEF_PIVOT_CACHE_STORAGE
Name of sub-storage in input file which contains pivot table cache data.
Declaration
public const string DEF_PIVOT_CACHE_STORAGE = "_SX_DB_CUR"
Field Value
| Type |
|---|
| string |
Properties
Application
Gets the application object. Read-only.
Declaration
public IApplication Application { get; }
Property Value
| Type |
|---|
| IApplication |
Count
Gets number of pivot cache items in the collection. Read-only.
Declaration
public int Count { get; }
Property Value
| Type |
|---|
| int |
this[int]
Gets a pivot cache with the specified index from the collection. Read-only.
Declaration
public PivotCacheImpl this[int id] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | Zero-based index of the cache to return. |
Property Value
| Type |
|---|
| PivotCacheImpl |
Order
Gets the ordered list of pivot caches. Read-only.
Declaration
public List<int> Order { get; }
Property Value
| Type |
|---|
| List<int> |
Parent
Gets the parent object. Read-only.
Declaration
public object Parent { get; }
Property Value
| Type |
|---|
| object |
Methods
Add(IRange)
Adds a new PivotTable cache to a PivotCaches collection.
Declaration
public IPivotCache Add(IRange range)
Parameters
| Type | Name | Description |
|---|---|---|
| IRange | range | Range that contains data to cache. |
Returns
| Type | Description |
|---|---|
| IPivotCache | Returns a pivot cache. |
Examples
Following code snippet illustrates how to add a pivot cache.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
// Create Pivot cache with the given data range
IPivotCache cache = workbook.PivotCaches.Add(worksheet["A1:H50"]);
Add(PivotCacheImpl)
Adds specified cache item to the collection.
Declaration
public void Add(PivotCacheImpl cache)
Parameters
| Type | Name | Description |
|---|---|---|
| PivotCacheImpl | cache | Item to add. |
Add(int, PivotCacheImpl)
Adds specified cache item to the collection at the specifed index.
Declaration
public void Add(int index, PivotCacheImpl cache)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | |
| PivotCacheImpl | cache | Item to add. |
Clear()
Clears all the pivot caches from the collection.
Declaration
public void Clear()
Clone(object)
Creates a new object that is a copy of the current instance.
Declaration
public object Clone(object parent)
Parameters
| Type | Name | Description |
|---|---|---|
| object | parent | Parent object for a copy of this instance. |
Returns
| Type | Description |
|---|---|
| object | A new object that is a copy of this instance. |
GetEnumerator()
Gets the IEnumerable list of pivot cache elements.
Declaration
public IEnumerator<PivotCacheImpl> GetEnumerator()
Returns
| Type |
|---|
| IEnumerator<PivotCacheImpl> |
GetIndexes()
Get Cache indexes
Declaration
public int[] GetIndexes()
Returns
| Type | Description |
|---|---|
| int[] | cache indexes |
Parse(ICompoundStorage, IDecryptor)
Parses pivot caches storage.
Declaration
public void Parse(ICompoundStorage storage, IDecryptor decryptor)
Parameters
| Type | Name | Description |
|---|---|---|
| ICompoundStorage | storage | Storage to parse. |
| IDecryptor | decryptor | Object used to decrypt encrypted records. |
RemoveAt(int)
Removes the Pivot cache from the collection at the specified index.
Declaration
public void RemoveAt(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index |
Serialize(ICompoundStorage, IEncryptor)
Serializes the pivot cache.
Declaration
public void Serialize(ICompoundStorage storage, IEncryptor encryptor)
Parameters
| Type | Name | Description |
|---|---|---|
| ICompoundStorage | storage | Storage to serialize into. |
| IEncryptor | encryptor | Object that is used to encrypt data. |