JS导出Excel,长数字串变成科学计数法的解决方案

本文转载至:js导出excel表格中较长数字串会变成科学计数法问题,同时感谢原作者的整理与创作;

JS 导出成 Excel 时,遇到个问题:当单元格中的数字超过 11 位时,会自动变成科学计数法;

页面上的原数据:
这里写图片描述

导出成 Excel 后,单元格内的数据:
这里写图片描述


解决方案:
在数字过长的数据列上加上这个样式即可解决:
style="mso-number-format:'\@';"


其他单元格样式:

CSS代码说明或示例
mso-number-format:”0”NO Decimals
mso-number-format:”0.000”3 Decimals
mso-number-format:”#,##0.000”Comma with 3 dec
mso-number-format:”mm\/dd\/yy”Date7
mso-number-format:”mmmm\ d,\ yyyy”Date9
mso-number-format:”m\/d\/yy\ h:mm\ AM\/PM”D -T AMPM
mso-number-format:”Short Date”01/03/1998
mso-number-format:”Medium Date”01-mar-98
mso-number-format:”d-mmm-yyyy”01-mar-1998
mso-number-format:”Short Time”5:16
mso-number-format:”Medium Time”5:16 am
mso-number-format:”Long Time”5:16:21:00
mso-number-format:”Percent”Percent - two decimals
mso-number-format:”0%”Percent - no decimals
mso-number-format:”0.E+00”Scientific Notation
mso-number-format:”\@”Text
mso-number-format:”#\ ???\/???”Fractions - up to 3 digits (312/943)
mso-number-format:”\0022£\0022#,##0.00”£12.76
mso-number-format:”#,##0.00_ \;[Red]-#,##0.00\ “2 decimals, negative numbers in red and signed (1.56 -1.56)
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值