C1DataColumn.NumberFormat vs. C1TrueDBGrid.SaveExcel

Posted by: ivan.stanojkovski on 7 January 2023, 11:03 am EST

    • Post Options:
    • Link

    Posted 7 January 2023, 11:03 am EST - Updated 7 January 2023, 11:08 am EST

    Hi

    When we use NumberFormat for Decimal type of DataColumn. The format displayed nicely in the grid, but when we export to excel, the values are mixed with the format.

    Here is the example of NumberFormat value in the DataColumn’s

    This is the example how its showed in the grid.

    This is the example how its exported to excel.

    If the problem is in the NumberFormat value, please tell as how to set the format to show:

    1. Only two decimal places
    2. Use 1000 separator

    Thanks in advance.

  • Posted 8 January 2023, 3:49 pm EST

    Hi,

    To show numeric values with thousands separators and up to 2 two decimal places, you can use the “N2” format string. This will export to Excel correctly without any errors. For other number formats, you can also refer to the MS documentation link below.

    (https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings)

    We have also attached a small sample project for your reference.

    Attachment: Tdbg.ExcelExport.zip

    Best Regards,

    Kartik

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels