Class PivotTableCollection
Represents collection of IPivotTable in the worksheet.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.XlsIO.Implementation.PivotTables
Assembly: Syncfusion.XlsIO.Base.dll
Syntax
public class PivotTableCollection : CollectionBaseEx<object>, IList<object>, ICollection<object>, IEnumerable<object>, IParentApplication, ICloneParent, IEnumerable<PivotTableImpl>, IEnumerable, IPivotTables
Constructors
PivotTableCollection(IApplication, Object)
Initializes a new instance of PivotTableCollection.
Declaration
public PivotTableCollection(IApplication application, object parent)
Parameters
Type | Name | Description |
---|---|---|
IApplication | application | Application object that represents the Excel application. |
System.Object | parent | Parent object of this collection. |
Properties
Item[Int32]
Gets a pivot table from the collection with the specified index.
Declaration
public IPivotTable this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Zero-based index of the pivot table. |
Property Value
Type | Description |
---|---|
IPivotTable |
Item[String]
Gets a pivot table from the collection with the specified name.
Declaration
public IPivotTable this[string name] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the pivot table. |
Property Value
Type | Description |
---|---|
IPivotTable |
ParentWorksheet
Gets the parent worksheet of this collection. Read-only.
Declaration
public WorksheetImpl ParentWorksheet { get; }
Property Value
Type | Description |
---|---|
WorksheetImpl |
Methods
Add(PivotTableImpl)
Adds specified table to the collection.
Declaration
public void Add(PivotTableImpl table)
Parameters
Type | Name | Description |
---|---|---|
PivotTableImpl | table | Table to add. |
Add(String, IRange, IPivotCache)
Adds a pivot table to the collection.
Declaration
public IPivotTable Add(string name, IRange location, IPivotCache cache)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the pivot table. |
IRange | location | Pivot table location. |
IPivotCache | cache | Pivot cache of the pivot table. |
Returns
Type | Description |
---|---|
IPivotTable | Returns the pivot table object. |
Examples
Following code snippet illustrates how to add a pivot table.
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 rangeS
IPivotCache cache = workbook.PivotCaches.Add(worksheet["A1:H50"]);
//Create "PivotTable1" with the cache at the specified range
IPivotTable pivotTable = worksheet.PivotTables.Add("PivotTable1", worksheet["A1"], cache);
Clone(WorksheetImpl, Dictionary<String, String>)
Creates copy of the current collection.
Declaration
public PivotTableCollection Clone(WorksheetImpl worksheet, Dictionary<string, string> hashWorksheetNames)
Parameters
Type | Name | Description |
---|---|---|
WorksheetImpl | worksheet | Parent worksheet for the new collection. |
System.Collections.Generic.Dictionary<System.String, System.String> | hashWorksheetNames |
Returns
Type | Description |
---|---|
PivotTableCollection | Created collection. |
Clone(Object)
Creates a new object that is a copy of the current instance.
Declaration
public object Clone(object parent)
Parameters
Type | Name | Description |
---|---|---|
System.Object | parent | Parent object for a copy of this instance. |
Returns
Type | Description |
---|---|
System.Object | A new object that is a copy of this instance. |
GetEnumerator()
Returns the IEnumerable list of pivot tables in the worksheet.
Declaration
public IEnumerator<PivotTableImpl> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<PivotTableImpl> |
Parse(IList, Int32)
Parses collection of pivot tables.
Declaration
public int Parse(IList data, int iPos)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IList | data | Records with pivot table data. |
System.Int32 | iPos | Offset to the first pivot table record. |
Returns
Type | Description |
---|---|
System.Int32 | Offset to the record after |
Remove(String)
Removes pivot table with specified name from this collection.
Declaration
public void Remove(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the pivot table to remove. |
RemoveAt(Int32)
Removes a pivot table with the specified index from this collection.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Index of the pivot table to remove. |
Serialize(OffsetArrayList)
Saves the collection of pivot tables into OffsetArrayList.
Declaration
[CLSCompliant(false)]
public void Serialize(OffsetArrayList records)
Parameters
Type | Name | Description |
---|---|---|
OffsetArrayList | records | OffsetArrayList that will get all collection's records. |
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |