0
我是新手引导,我需要将表格内容导出为excel文件,因为我使用jquery.table2excel.js
。在导出内容时,它会省略thead和tfoot。我如何在excel文件中包含tfoot和thead。请建议我实现这一目标。如何将Bootstrap Data表的所有行导出为excel?
$(function() {
$("#target").click(function() {
$('<table>')
.append(
$("#example2").DataTable().$('tr').clone()
)
.table2excel({
exclude: ".excludeThisClass",
name: "Worksheet Name",
filename: "SomeFile" //do not include extension
});$("#example2").dataTable();
});
});
我的HTML表格看起来像这样,
<table id="example2" class="table table-bordered table-hover" >
<thead>
<tr>
<th>S.No.</th>
<th>Date</th>
<th>Process</th>
<th>count</th>
</tr>
</thead>
<tbody>
<tr>
<td>1<td>
<td>2015-11-04<td>
<td>Java<td>
<td>10<td>
</tr>
</tbody>
<tfoot class="bg-gray">
<tr>
<th colspan="3">Summary</th>
<th>10</th>
</tr>
</tfoot>
<table>
排序,搜索和分页表我已经用下面的代码。
$(function() {
$('#example2').dataTable({
"bPaginate": true,
"bLengthChange": true,
"bFilter": true,
"bSort": true,
"bInfo": true,
"bAutoWidth": false
});
});
你的HTML表? – madalinivascu
@madalinivascu我已添加html表格。 –