[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotTable.CalculatedFields

CalculatedFields Property

CalculatedFields

Gets the collection of calculated fields in this PivotTable report.

Use the returned ICalculatedFields collection to access or add calculated fields for the current PivotTable.

Declaration
ICalculatedFields CalculatedFields { get; }
ReadOnly Property CalculatedFields As ICalculatedFields
Examples
worksheet.Range["A1:B4"].Value = new object[,] {
    {"Product", "Amount"},
    {"Apple", 120},
    {"Orange", 90},
    {"Apple", 80}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:B4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["D1"], "SalesPivot");
ICalculatedFields calculatedFields = pivotTable.CalculatedFields;
calculatedFields.Add("DoubleAmount", "=Amount*2");