如何允许导出到csv的前导零 [英] How to allow leading zero on export to csv

查看:198
本文介绍了如何允许导出到csv的前导零的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

单击按钮,我们在aspx页面中具有转发器控件,我们将所有转发器控制数据导出到csv文件.问题是,如果我在转发器控件中输入0012并导出到csv并打开csv文件,它将不会显示前导零 在csv文件中,它将显示12.请让我知道如何在导出时以编程方式将Number格式更改为文本.

We are having repeater control in our aspx page on click of button we are exporting all the repeater control data to csv file. Issue is if I enter 0012 in the repeater control and do export to csv and open the csv file it will not show leading  zeros in csv file it will display 12. Please let me know how to change the Number format to text programmatically on export.

使用.NET 2.0和C#

Using .NET 2.0 and C#

谢谢..

推荐答案

我想您正在Excel中打开.csv文件?将单元格格式指定为文本",您应该可以看到零.如果在记事本中打开它,应该会看到零实际上在那里.

I guess you are opening the .csv-file in Excel? Specify the cell format as Text and you should be able to see the zeros. If you open it in Notepad, you should see that the zeros are actually there.

http:///social.msdn.microsoft.com/Forums/zh-CN/1957cdbe-2ca8-4a29-8284-31348977046a/losting-leading-zero-in-csv


这篇关于如何允许导出到csv的前导零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆