$("#export-excel").live('click', function(e) {
window.open('data:application/vnd.ms-excel,' + $('#table-div').html());
e.preventDefault();
});
这个代码在导出时一直抓取html标签,所以在excel doc中它出现为<table><tbody>
.....
答案 0 :(得分:1)
You can't just set the content type to Excel format and then expect the code to convert itself to Excel.. You actually have to convert the HTML code to the required formatting of Excel.
Have a look at: How can I export tables to excel from a webpage