[]
Gets the range that contains the data area of the PivotTable report.
The returned range represents the cells between the header area and the insert row.
IRange DataBodyRange { get; }
ReadOnly Property DataBodyRange As IRange
worksheet.Range["A1:B5"].Value = new object[,] {
{"Category", "Amount"},
{"Fruit", 120},
{"Fruit", 80},
{"Vegetables", 95},
{"Vegetables", 60}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:B5"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["D1"], "SalesPivot");
pivotTable.PivotFields["Category"].Orientation = PivotFieldOrientation.RowField;
pivotTable.AddDataField(pivotTable.PivotFields["Amount"], "Sum of Amount", ConsolidationFunction.Sum);
IRange range = pivotTable.DataBodyRange;