导出为零的前导零不显示 [英] leading zero are not displaying in export to excel

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

问题描述

虽然导出数据到excel前导零没有在导出到excel时显示。解决方法是什么。

While exporting the data to the excel leading zeros are not displaying in export to excel.What is the solution for this.

推荐答案

那是因为Excel正在读取它并将其视为数字 - 因此它会删除所有前导零。



在设置值之前将Excel列格式化为文本,它将正常工作。



[edit]

请看这里的例子: http://stackoverflow.com/questions/2067926/format-an-excel-column-or-cell-as-text-in- c [ ^ ]

[/ edit]
That's because Excel is reading it and seeing it as a number - so it strips all leading zeros.

Format the Excel column as text before you set the values, and it'll work fine.

[edit]
See here for an example: http://stackoverflow.com/questions/2067926/format-an-excel-column-or-cell-as-text-in-c[^]
[/edit]


查看以下链接。



避免导出时的默认格式g数据从datagrid到excel。 [ ^ ]
Check the below link.

Avoid default formatting when exporting data from datagrid to excel.[^]


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

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