我使用JavaScript将HTML导出为Excel xls
文件,如以下演示所示:http://js.do/sun21170/84913。我已经使用谷歌浏览器来运行这个演示,但它应该运行在边缘或IE或FireFox也。Excel导出为html无法在Excel 2016中显示边框
问题是,当我在Excel 2016
中打开导出的文件时,即使导出的html中存在CSS以显示边框,它也将显示为没有任何边框。
问题:在Excel中打开html文件时,有没有办法显示边框?在Excel中打开的同一个html,在浏览器中呈现边框,所以CSS的边框是正确的。在http://js.do/sun21170/84913的演示还显示了保存在Excel文件中的html。
HTML保存为xls文件
<html>
<head>
<style> table, td {border:1px solid black} table {border-collapse:collapse}</style>
</head>
<body>
<table>
<tr>
<td>Product</td>
<td>Customer</td>
</tr>
<tr>
<td>Product1</td>
<td>Customer1</td>
</tr>
<tr>
<td>Product2</td>
<td>Customer2</td>
</tr>
<tr>
<td>Product3</td>
<td>Customer3</td>
</tr>
<tr>
<td>Product4</td>
<td>Customer4</td>
</tr>
</table>
</body>
</html>
大的
边框厚度。完美的作品。我试图修复Excel的一年在你的答案,但很小的变化是不允许在stackoverflow –
何塞,谢谢指出。我已更正Excel的年份。 – Sunil