Export Html Table to Excel Using jquery

First import one jquery file jquery.battatech.excelexport.js.

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

Popular posts from this blog

Unable to perform operation on the item is locked in workspace

Maximum Stored Procedure Function Trigger or View Nesting Level Exceeded (limit 32) in SQL Server

Angular Issue:- ng.ps1 cannot be loaded because running scripts is disabled on this system