Export table to excel how to modify the disappearance of style

Work encountered a demand, form the background you want to export to excel how the table styles that modify it?
In fact, the table is derived first need to understand two plug-ins: jquery.table2excel.js and tableExport.js

1, the first step, to write an export button button

<button id="datatable">导出</button>

2. The second step, initialization js

①jquery.table2excel.js

$('button').click(function(){   
        $("#datatable").table2excel({  
           exclude: ".noExl",  
           name: "Excel Document Name",  
           filename: "myFileName",  //此处为导出的文件名
           exclude_img: true,  
           exclude_links: true,  
           exclude_inputs: true  
           ///////此处的配置项可以根据需求配置
        });  
        }) 

②tableExport.js

$("button").click(function(){
        $('#datatable').tableExport({
        type:'excel',
        escape:'false',
        fileName: 'myFileName'//此处为导出的文件名
        ///////此处的配置项可以根据需求配置
        });
    });

3. If the exported style tables can not be exported to excel, need to write in the js in the following figure

4, the last introduced corresponding js file in your HTML file.

Guess you like

Origin www.cnblogs.com/shemingxin/p/11837189.html
Recommended