To write HTML table as it is inside the Excel file user must first create the html table inside the div element then you can write that table as it is in Excel file. Here I created HTML table inside the div whose id is divTable. Then I exported that div to the Excel using window.open(). In window.open() function I specified data type as application/vnd.ms-excel. Following code is used to write HTML table into the Excel file. Here on button click HTML table which is present in the div whose id is "divTable" will be get printed into the Excel file. $("#btnExcelExport").click(function(e) { window.open('data:application/vnd.ms-excel,' + $('#divTable').html()); e.preventDefault(); });
Monday 19 May 2014
Export HTML Table to Excel file using Jquery
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment