[]
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.
IPivotTable CreatePivotTable(IRange TableDestination, string TableName = null)
Function CreatePivotTable(TableDestination As IRange, Optional TableName As String = Nothing) As IPivotTable
| 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 |
| string | TableName | The name of the new pivot table report. This value can be |
| Type | Description |
|---|---|
| IPivotTable | The created IPivotTable object. |
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;