Back to Devexpress

PivotField.NumberFormat Property

officefileapi-devexpress-dot-spreadsheet-dot-pivotfield-e7ade55b.md

latest4.2 KB
Original Source

PivotField.NumberFormat Property

Specifies a number format (in the invariant culture) used to display numeric values (for example, date and time) within the PivotTable field.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
string NumberFormat { get; set; }
vb
Property NumberFormat As String

Property Value

TypeDescription
String

The number format to apply to the pivot field.

|

Remarks

The Spreadsheet allows you to use Microsoft Excel number formats to format numeric values within a row, column, or page field. Use the PivotField.NumberFormatLocal property to specify a number format based on the local culture defined by the DocumentOptions.Culture property. The NumberFormat option allows you to obtain or specify a number format in the invariant culture.

To apply a number format to a data field, use the PivotDataField.NumberFormat or PivotDataField.NumberFormatLocal property.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the NumberFormat property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-spreadsheet-pivot-table-api-examples/CS/SpreadsheetWPFPivotTableExamples/CodeExamples/PivotFieldActions.cs#L27

csharp
// Specify the number format for the "Sales" field.
pivotTable.Fields["Sales"].NumberFormat = @"_([$$-409]* #,##0.00_);_([$$-409]* (#,##0.00);_([$$-409]* "" - ""??_);_(@_)";
#endregion #AddToAxis

wpf-spreadsheet-pivot-table-api-examples/VB/SpreadsheetWPFPivotTableExamples/CodeExamples/PivotFieldActions.vb#L28

vb
' Specify the number format for the "Sales" field.
            pivotTable.Fields("Sales").NumberFormat = "_([$$-409]* #,##0.00_);_([$$-409]* (#,##0.00);_([$$-409]* "" - ""??_);_(@_)"
' #End Region ' #AddToAxis

See Also

PivotField.NumberFormatLocal

PivotDataField.NumberFormat

PivotDataField.NumberFormatLocal

PivotField Interface

PivotField Members

DevExpress.Spreadsheet Namespace