ComponentOne FlexPivot for WinForms
Data Blending Features / Formatting Numeric Data
In This Topic
    Formatting Numeric Data
    In This Topic

    FlexPivot provides the option to format and represent numeric data in various formats such as number, currency, scientific, and percentage. You can also use custom format so that the numbers appears the way you want.

    At Runtime

    1. Right-click a field in the Values list in the pivot panel.
    2. Click Field Settings option in the context menu to open Field Settings dialog.
    3. Click the Format tab and select one of the following options.
      Numeric Formats the data as a number such as 1,235. You can specify the number of decimal places, and whether to use thousand separator (,) or not.
      Currency Formats the data as currency. You can specify the number of decimal places.
      Percentage Formats the data as percentage. You can specify the number of decimal places.
      Scientific Formats the data in scientific notation. You can specify the number of decimal places.
      Custom Applies a custom format to the data.
    4. Click OK and observe how the format of numeric data changes.

    In Code

    You can format numeric data using the Format property and standard numeric format strings in code. Following enlisted are the accepted format strings to be used in code.

    "N" or "n" Numeric Formats data as h numbers such as 1,k235. You can specify the number of decimal places and whether to use thousand separator (,) or not.
    "C" or "c" Currency Formats the data as currency. You can specify the number of decimal places.
    "P" or "p" Percentage Formats the data as percentage. You can specify the number of decimal places.
    "E" or "e" Scientific Formats the data in scientific notation. You can specify the number of decimal places.
    Non-standard numeric strings Custom Apply a custom format to the data.

    Use the following code to format numeric data in Currency format.

    //formatting numeric data in code
    Dim field = fp.Fields("ExtendedPrice")
    field.Format = "c"
    
    //formatting numeric data in code
    var field = fp.Fields["ExtendedPrice"];
    field.Format = "c";