Export Html Table to Excel Using jquery
First import one jquery file jquery.battatech.excelexport.js.
<html>
<head>
<title></title>
<script src="Js/jquery.battatech.excelexport.js" type="text/javascript"></script>
<script type="text/javascript">
function btnExport_onclick() {
$("#tblcat").btechco_excelexport({
containerid: "tblcat",
datatype: $datatype.Table
});
window.location.reload();
return false;
}
</script>
</head>
<body>
<input type="button" id="btnExport" value="Export" onclick="return btnExport_onclick()" />
<table id="tblcat" class="display" cellspacing="0" width="100%" border="1" >
<thead>
<tr style="background-color:#5C677E;color:#FFFFFF;">
<th style="width: 10%;">
S. No.
</th>
<th style="width: 10%; display: none;">
ID
</th>
<th style="width: 25%;">
Code
</th>
<th style="width: 40%;">
Name
</th>
</tr>
</thead>
</table>
</body>
</html>
Code:
<html>
<head>
<title></title>
<script src="Js/jquery.battatech.excelexport.js" type="text/javascript"></script>
<script type="text/javascript">
function btnExport_onclick() {
$("#tblcat").btechco_excelexport({
containerid: "tblcat",
datatype: $datatype.Table
});
window.location.reload();
return false;
}
</script>
</head>
<body>
<input type="button" id="btnExport" value="Export" onclick="return btnExport_onclick()" />
<table id="tblcat" class="display" cellspacing="0" width="100%" border="1" >
<thead>
<tr style="background-color:#5C677E;color:#FFFFFF;">
<th style="width: 10%;">
S. No.
</th>
<th style="width: 10%; display: none;">
ID
</th>
<th style="width: 25%;">
Code
</th>
<th style="width: 40%;">
Name
</th>
</tr>
</thead>
</table>
</body>
</html>
Comments
Post a Comment
Thank You for your Comment