出口的Execl的是不使用任何服務器端語言非常艱難的工作,但你可以寫XML代碼到數據表導出XLS甲,我有一些工作示例 請找代碼和文件here
這是jQuery插件
和我寫的示例代碼導出文件
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/chintanTableDesign_1.css"/>
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="http://eportal.esparkbiz.com/asset/js/export_execl_js/jquery.battatech.excelexport.js" language="javascript" type="text/javascript"></script>
</head>
<body>
<table class="tableChintan" width="100%">
<tr>
<th colspan="10" style="font-size: 25px;text-align: center">
ABC Pvt. ltd.
</th>
<th>
<select id="type_account" name="type_account" onchange="GetFilter();">
<option value="ALL" >ALL</option>
<option value="AC" >AC</option>
<option value="CASH" >CASH</option>
<option value="PF" selected>PF</option>
</select>
</th>
<th>
<a id="btnExport" href="javascript:void(0);"> EXPORT</a>
</th>
</tr></table>
<table class="tableChintan" width="100%" id="tblExport">
<tr>
<th>Employee Name</th>
<th>Month</th>
<th>BASIC</th>
<th>DA</th>
<th>HRA</th>
<th>TA</th>
<th>Sp Allownce</th>
<th>LEAVE ENCASH</th>
<th>abs_days</th>
<th>extra_days</th>
<th>PF EMP</th>
<th>PF COMP</th>
<!-- <th>ESI EMP</th>
<th>ESI COMP</th>-->
<th>PT</th>
<th>TOTAL SAL CHEQUE</th>
<th>actual_sal </th>
<th>actual_sal WP</th>
<th>NA</th>
<th></th>
</tr>
</tr></table>
</table>
</body>
</html>
<script type="text/javascript">
$(document).ready(function() {
$("#btnExport").click(function() {
$("#tblExport").btechco_excelexport({
containerid: "tblExport"
, datatype: $datatype.Table
});
});
});
</script>
請不要忘了,包括您的jquery.min.js
請不要嘗試,如果你想強行重命名文件,然後讓我知道我有同樣的
另一個jQuery插件享受!!!!!!!!!!!!
這可能會有幫助。 http://superuser.com/questions/836324/cells-not-updating-automatically/836325 – Badr
我沒有設法糾正從數據表導出。我通過從Datatable獲取所有數據並將其寫入新的電子表格,然後將該電子表格作爲Excel下載,從而解決了我的問題。 –