[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotTables.Add

Add Method

Add(IPivotCache, IRange, string)

Adds a new PivotTable report.

Creates a PivotTable report from the specified IPivotCache and places it at the specified destination range on the worksheet that contains this IPivotTables collection.

Declaration
IPivotTable Add(IPivotCache PivotCache, IRange TableDestination, string TableName = null)
Function Add(PivotCache As IPivotCache, TableDestination As IRange, Optional TableName As String = Nothing) As IPivotTable
Parameters
Type Name Description
IPivotCache PivotCache

The PivotTable cache on which the new PivotTable report is based. This parameter must not be null.

IRange TableDestination

The upper-left cell of the destination range where the PivotTable report is placed. The destination range must be on the worksheet that contains this IPivotTables collection and must not be null.

string TableName

The name of the new PivotTable report. This value can be null.

Returns
Type Description
IPivotTable

The created IPivotTable report.

Examples
worksheet.Range["A1:C4"].Value = new object[,] {
    {"Region", "Product", "Amount"},
    {"East", "Apple", 120},
    {"West", "Apple", 80},
    {"East", "Orange", 90}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:C4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["E1"], "SalesPivot");