<a class="btn btn-info btn-xm" style="margin-bottom: 10px;" id="execlOut">導出數據</a>
<table class="table table-bordered table-hover" id="tableExecl">
<tr>
<th></th>
<th>一</th>
<th>二</th>
<th>三</th>
<th>四</th>
</tr>
<tr>
<td>萬籟寂無聲</td>
<td>衾鐵棱棱近五更</td>
<td>香斷燈昏吟未穩</td>
<td>悽清</td>
<td>只有霜華伴月明</td>
</tr>
<tr>
<td>應是夜寒凝</td>
<td>惱得梅花睡不成</td>
<td>我念梅花花念我</td>
<td>關情</td>
<td>起看清冰滿玉瓶</td>
</tr>
</table>
<script type="text/javascript" src="js/jquery.table2excel.min.js"></script>
<script>
$("#execlOut").click(function() {
var pageTitle = $('#pageTitle').attr('value');
var monthName = GetRequest().month ? GetRequest().month : (new Date().getFullYear()) + '-' + (new Date().getMonth()+1);
var filename = pageTitle + '-' + $('#selectCenter option:selected').text() + monthName + '.xls';
$("#tableExecl").table2excel({
// 不被導出的表格行的CSS class類
exclude: "",
// 導出的Excel文檔的名稱,(沒看到作用)
name: "Excel Document Name",
// Excel文件的名稱
filename: filename
});
});
</script>
jquery.table2excel.js 下載地址:https://github.com/rainabba/jquery-table2excel/tree/master/dist