CSV Exporting: Preserving leading zeros

前端 未结 4 572
后悔当初
后悔当初 2020-12-21 21:25

I\'m working on a .NET application which exports CSV files to open in Excel and I\'m having a problem with preserving leading zeros when the file is opened in Excel. I\'ve

4条回答
  •  情深已故
    2020-12-21 22:07

    I found a nice way around this, if you add a space anywhere along the phone number, the cell is then not treated as number and is treated as a text cell in both Excel and Apple's iWork Numbers.

    It's the only solution I've found so far that plays nice with Numbers.

    Yes I realise the number then has a space, but this is easy to process out of large chunks of data, you just have to select a column and remove all spaces.

    Also, if this is web related, most web type things are ok with users entering a space in the number field. E.g you can tap-to-call on mobiles.

    The challenge is to get the space in there in the first place.

    In use:

    01202123456 = 1202123456

    but

    01202 123456 = 01202 123456

提交回复
热议问题