只要想不到,没有做不到,一直都不知道html里table元素可直接导出为excel,太牛逼了!
这其中用到一个jquery的插件table2excel
使用方法也很简单:
1 。 包含必要的文件
2。 创建导出按钮
export
3。 给导出按钮添加事件
$(.table2excel).table2excel({ exclude: .noexl, // 不想导出的行加上class='noexl'即可 name: excel document name, // excel文档名 filename: myfilename // excel文件名});
完整的看下demo
jquery boilerplate this shouldn't get exported this shouldn't get exported either
this should get exported as a header this should too
data1a data1b
data2a data2b
this footer spans 2 cells
this shouldn't get exported this shouldn't get exported either
this should get exported as a header this should too
data1a data1b
data2a data2b
this footer spans 2 cells