Export to Excel with long number

When I export to Excel, if the data type is long, the output number will be in scientific notation. I wonder if there is any way to force the export of long to be in string format as well? Or is it possible to provide a option that can control the output format preference?

Comments

  • i2van
    edited January 2025

    You can format cell in Excel itself (default one is General, which has no specific number representation). It can be also done via Excel interop.

  • If the number should be treated as a string, call .ToString() before exporting. Excel will then show you all the digits without trying to format it.