Export to Excel truncates numbers

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Reggie

    Export to Excel truncates numbers

    Hi and TIA! I'm exporting a dataset/datgrid to excel but some text fields
    get converted to numbers in excel and I loose leading zero's. I've tried
    several methods with no success. If anyone has come across this and can
    point me in the right direction I would appreciate it. Thanks!

    --

    *************** ***
    Reggie


  • Jeroen Mostert

    #2
    Re: Export to Excel truncates numbers

    Reggie wrote:
    Hi and TIA! I'm exporting a dataset/datgrid to excel but some text fields
    get converted to numbers in excel and I loose leading zero's. I've tried
    several methods with no success. If anyone has come across this and can
    point me in the right direction I would appreciate it. Thanks!
    >
    I'm setting followups for this question to microsoft.publi c.excel since this
    is not a .NET-specific question.

    The way to avoid is is to ensure that you are actually writing the data as
    text. In formula form, it should be ="00123" and not =00123, for example.
    How you do this depends on how you're doing the export. For automation, you
    can use the "Formula" property of a Range object, for export, you're
    probably best off with XML, as you can't specify data types in CSV.

    --
    J.

    Comment

    Working...