导出excel 较长数字串会变成科学计数法

来源:互联网 发布:access软件开发案例 编辑:程序博客网 时间:2024/04/24 16:42

在做项目中,碰到如题的问题。比如要将居民的信息导出到excel中,居民的身份证号码因为长度过长(大于10位),excel会自动的将过长的数字串转换成 科学计数法。现在网上找到解决方案之一:

(在数字串前后加 " " 或' ' 或 tab等空白内容都是行不通的,excel会自动去掉这些。除非你在数字串中间加,当然这样就不是我们要的结果了)

解决方案之一:<td style="mso-number-format:'\@';">100821199909091234</td>

增加了  style="mso-number-format:'\@';" 样式后 可以解决

(以上为亲自测试过,可行)!

另外网上有称增加css样式可行的,找了几个试了下,没找到正确的。

其他自定义单元格格式 样式

mso-number-format:"0"NO Decimalsmso-number-format:"0\.000"3 Decimalsmso-number-format:"\#\,\#\#0\.000"Comma with 3 decmso-number-format:"mm\/dd\/yy"Date7mso-number-format:"mmmm\ d\,\ yyyy"Date9mso-number-format:"m\/d\/yy\ h\:mm\ AM\/PM"D -T AMPMmso-number-format:"Short Date"01/03/1998mso-number-format:"Medium Date"01-mar-98mso-number-format:"d\-mmm\-yyyy"01-mar-1998mso-number-format:"Short Time"5:16mso-number-format:"Medium Time"5:16 ammso-number-format:"Long Time"5:16:21:00mso-number-format:"Percent"Percent - two decimalsmso-number-format:"0%"Percent - no decimalsmso-number-format:"0\.E+00"Scientific Notationmso-number-format:"\@"Textmso-number-format:"\#\ ???\/???"Fractions - up to 3 digits (312/943)mso-number-format:"\0022£\0022\#\,\#\#0\.00"£12.76mso-number-format:"\#\,\#\#0\.00_ \;\[Red\]\-\#\,\#\#0\.00\ "

2 decimals, negative numbers in red and signed
(1.56   -1.56
)

原创粉丝点击