Skip to main content

How to: Format Cell Values

This example demonstrates how to format values in pivot grid cells.

The PivotGridField.CellFormat property is used to format data in a custom manner. By default, cell values that correspond to currency fields are formatted as currency amounts (the formatting settings are determined by the regional settings). For the "English (United States)" culture, two digits are displayed to the right of the decimal point. In this example, the PivotGridField.CellFormat property is used to format cell values for the Freight field in a different manner. Data in these cells is formatted as integer currency values (without fractional portions).

Grand Total values are enclosed with round brackets in this sample. This setting is specified by the PivotGridField.GrandTotalCellFormat property.