如何在Excel文件中编写 [英] How to write in Excel file

查看:72
本文介绍了如何在Excel文件中编写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

如何使用c#,ASP.Net在excel文件中编写?实际上我已将我的数据写入excel文件。但是当打开输出Excel文件时,数字前的0会被截断。

,例如001773转换为1773.



如何防止这种情况?



谢谢

Hi All,
How to write in excel file using c#, ASP.Net? Actually I have written my data into excel file. But 0's before number are getting truncated when I open the output Excel file.
e.g. 001773 gets converted to 1773.

How to prevent this?

Thanks

推荐答案

不,001773无法转换为1773.这是相同的数字。



你不明白数字和字符串表示之间的差异,这就是为什么你问一个完全没有意义的问题。如果你想以某种方式将数字表示为字符串,你应该学习格式化:

http://msdn.microsoft.com/en-us/library/dwhawy9k(v = vs.110).aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/0c899ak8 (v = vs.110).aspx [ ^ ]。



-SA
No, 001773 could not be "converted" to 1773. This is the same number.

You don't understand the difference between a number and its string representation, that's why you asked a question which makes no sense at all. If you want to represent a number as a string in certain way, you should learn formatting:
http://msdn.microsoft.com/en-us/library/dwhawy9k(v=vs.110).aspx[^],
http://msdn.microsoft.com/en-us/library/0c899ak8(v=vs.110).aspx[^].

—SA


这篇关于如何在Excel文件中编写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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