本帖最后由 CrLf 于 2014-5-9 20:35 编辑
举个例子,把下面的内容保存为 test.xls,即可看到效果: | <head> | | <style> | | table | | { | | border:1pt solid; | | } | | td | | { | | border:.5pt solid; | | } | | ;样式示例 | | </sytle> | | </head> | | | | <table> | | <th style="background-color:yellow;"> | | <td style="background-color:yellow;">序号</td> | | <td colspan=2 style="background-color:yellow;">示例</td> | | </th> | | <tr> | | <td rowspan=2>跨行示例</td> | | <td>1</td> | | <td colspan=2>跨列示例</td> | | </tr> | | <tr> | | <td>2</td> | | <td href="http://www.baidu.com" style="font-weight:bold"><b><s>标签示例 粗体与删除线</s></b></td><td style="color:blue" href="http://bbs.bathome.net">属性示例 颜色与链接</td> | | </tr> | | <img src="http://www.baidu.com/img/bdlogo.gif" /> | | </table>COPY |
测试中发现几个不如意的地方: | 导出的 html 是支持 class 引用的,但自己组装的不知道为啥未生效(也许是我忽略了什么东西吧...) | | 有些属性不被继承(也许是我忽略了什么东西吧...) | | 某些属性不能只应用于局部文字内容(原生 xls 也是如此) | | 设置的事件不生效(情理之中)COPY |
有了思路后,如何用脚本生成 html 就只是体力活罢了 |