最近公司改后臺管理系統(tǒng)。要求導(dǎo)出臺賬項目等等為excel表格,找半天還真有,他是通過query.table2excel.js 實現(xiàn),原諒我原生不會弄這個當(dāng)然大家有可以給我留言。
<!DOCTYPE html><html> <head> <meta charset="utf-8" /> <title></title> </head> <body> <table class="table"> //表格 <tr class="noExl"> //加class是為了有些你不想導(dǎo)出用來選則 <th>Header</th> <th>111</th> </tr> <tr> <td>Data</td> <td>222</td> </tr> </table> <button id="btn">導(dǎo)出</button> <script src="js/jquery-1.11.0.min.js" type="text/javascript" charset="utf-8"></script>//引入jquery <script src="js/jquery.table2excel.js" type="text/javascript" charset="utf-8"></script> //引入jquer插件 <script type="text/javascript"> $("#btn").click(function(){ //點擊按鈕執(zhí)行導(dǎo)出 $(".table").table2excel({ //選取導(dǎo)出的表格 exclude: ".noExl", //寫你不想都想導(dǎo)出的 name: "Excel Document Name", filename: "項目", //導(dǎo)出的文件名 exclude_img: true, //是否導(dǎo)出圖片 exclude_links: true, exclude_inputs: true }); }) </script> </body></html>以上這篇前端把html表格生成為excel表格的實例就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持武林網(wǎng)。
新聞熱點
疑難解答