【发布时间】:2016-10-30 18:28:09
【问题描述】:
我想将 html 表格导出到 Excel。
表:
<div id="table">
<table>
<thead>
<tr>
<th>Column</th>
<th>Column</th>
</tr>
</thead>
<tbody id="tabbodyExp">
<tr>
<th>2.5</th>
<th>2.6</th>
</tr>
</tbody>
</table>
</div>
脚本:
$("#btnExport").click(function (e) {
window.open('data:application/vnd.ms-excel,' + $('#table').html());
e.preventDefault();
});
但是 excel 正在将所有像“2.5”这样写的数字转换为日期。有没有办法阻止这种情况,还是我必须写出像“2,5”这样的所有数字。
【问题讨论】:
标签: javascript html excel