Blogger Information
Blog 33
fans 0
comment 1
visits 43067
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
使用JQuery插件 tableExport 将HTML表格导出为Excel格式表格
萝卜温的博客
Original
1495 people have browsed it

demo代码如下:

<div class="row">
   <div class="col-lg-12">
      <div>
         <button class="btn btn-primary" type="button" onclick="export2excel()">导出为Excel</button>
      </div>
      <table class="table table-hover" id="mytable">
         <thead>
         <tr>
            <th>驻点村居</th>
            <th>投稿数(总)</th>
            <th>投稿数(待审核)</th>
            <th>投稿数(审核通过)</th>
            <th>投稿数(审核不通过)</th>
         </tr>
         </thead>
         <tbody>
         <tr>
            <td>某镇某村/社区</td>
            <td>888</td>
            <td>8</td>
            <td>800</td>
            <td>80</td>
         </tr>
         <tr>
            <td>某镇某村/社区</td>
            <td>888</td>
            <td>8</td>
            <td>800</td>
            <td>80</td>
         </tr>
         <tr>
            <td>某镇某村/社区</td>
            <td>888</td>
            <td>8</td>
            <td>800</td>
            <td>80</td>
         </tr>
         </tbody>
      </table>
   </div>
</div>
<!--jquery一定要在前面被加载-->
<script src="resource/js/lib/jquery-1.11.1.min.js"></script>
<script src="resource/js/lib/FileSaver.min.js"></script>
<script src="resource/js/lib/tableExport.min.js"></script>
<script>
   function export2excel () {
        $('#mytable').tableExport({type:'excel'});
   }
</script>


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post