[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotField.NumberFormat

NumberFormat Property

NumberFormat

Gets or sets the number format code for the pivot field.

Declaration
string NumberFormat { get; set; }
Property NumberFormat As String
Examples
object[,] sourceData = new object[,] {
    {"Category", "Amount"},
    {"Fruit", 1200},
    {"Fruit", 800},
    {"Vegetables", 600}
};
worksheet.Range["A1:B4"].Value = sourceData;
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:B4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["D1"], "SalesPivot");
IPivotField amountField = pivotTable.PivotFields["Amount"];
amountField.Orientation = PivotFieldOrientation.DataField;
amountField.NumberFormat = "$#,##0.00";
string numberFormat = amountField.NumberFormat;