html页面里table导出为excel_html/css_WEB-ITnose

原创
2016-06-21 09:09:10 1050浏览

只要想不到,没有做不到,一直都不知道html里table元素可直接导出为excel,太牛逼了!

这其中用到一个jquery的插件table2excel

使用方法也很简单:

1 。 包含必要的文件

2。 创建导出按钮

3。 给导出按钮添加事件

$(".table2excel").table2excel({  exclude: ".noExl",  // 不想导出的行加上class='noExl'即可  name: "Excel Document Name", // excel文档名  filename: "myFileName" // excel文件名});

完整的看下DEMO

nbsp;html>      jQuery Boilerplate                
This shouldn't get exportedThis shouldn't get exported either
This Should get exported as a headerThis should too
data1adata1b
data2adata2b
This footer spans 2 cells
This shouldn't get exportedThis shouldn't get exported either
This Should get exported as a headerThis should too
data1adata1b
data2adata2b
This footer spans 2 cells


声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。