[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.ICalculatedFields.Count

Count Property

Count

Returns the number of calculated fields.

This property returns the number of calculated fields in the collection returned by CalculatedFields for a PivotTable report.

Declaration
int Count { get; }
ReadOnly Property Count As Integer
Examples
object[,] sourceData = {
    {"Product", "Amount"},
    {"Apple", 100},
    {"Pear", 200}
};
worksheet.Range["A1:B3"].Value = sourceData;
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:B3"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["D1"], "PivotTable1");
pivotTable.CalculatedFields.Add("Tax", "=Amount*0.1");
int count = pivotTable.CalculatedFields.Count;