[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotCache.CreatePivotTable

CreatePivotTable Method

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.

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

The upper-left cell of the destination range where the new pivot table report will be placed. This value must not be null

string TableName

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

Returns
Type Description
IPivotTable

The created IPivotTable object.

Examples
worksheet.Range["A1:C4"].Value = new object[,] {
    {"Product", "Region", "Amount"},
    {"Apple", "East", 100},
    {"Apple", "West", 120},
    {"Pear", "East", 90}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:C4"]);
IPivotTable pivotTable = pivotCache.CreatePivotTable(worksheet.Range["E1"], "SalesSummary");
pivotTable.PivotFields["Product"].Orientation = PivotFieldOrientation.RowField;