[]
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.
ICalculatedFields CalculatedFields { get; }
ReadOnly Property CalculatedFields As ICalculatedFields
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");