[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotField.CalculatedItems

CalculatedItems Method

CalculatedItems()

Gets the collection of calculated items for this IPivotField.

The returned ICalculatedItems collection represents all calculated items defined for the current PivotTable field and can be used to access or add calculated items.

Declaration
ICalculatedItems CalculatedItems()
Function CalculatedItems() As ICalculatedItems
Returns
Type Description
ICalculatedItems

The calculated items collection for this pivot field.

Examples
worksheet.Range["A1:C4"].Value = new object[,] {
    {"Region", "Product", "Amount"},
    {"East", "Apple", 120},
    {"East", "Banana", 80},
    {"West", "Apple", 90}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:C4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["E1"], "SalesPivot");
pivotTable.PivotFields["Region"].Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Product"].Orientation = PivotFieldOrientation.ColumnField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
ICalculatedItems calculatedItems = pivotTable.PivotFields["Product"].CalculatedItems();