 |
|
ผมใช้ javascript ทำการ Export to Excel เลือก open แล้วมันขึ้น error ครับ
Code (JavaScript)
var tableToExcel = (function () {
//var uri = 'data:application/vnd.ms-excel;base64,'
var uri = 'data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,'
, template = '{table}'
, base64 = function (s) { return window.btoa(unescape(encodeURIComponent(s))) }
, format = function (s, c) { return s.replace(/{(\w+)}/g, function (m, p) { return c[p]; }) }
return function (table, name, filename) {
if (!table.nodeType) {
table = document.getElementById(table);
}
var ctx = { worksheet: name || 'Worksheet', table: table.innerHTML }
document.getElementById("TmpaExportTable").href = uri + base64(format(template, ctx));
document.getElementById("TmpaExportTable").download = filename;
document.getElementById("TmpaExportTable").click();
}
})();
Code
<li><a href="#" onclick="ExportFile('Excel');" id="aExportExcel">Excel (*.xlsx)</a></li>

Tag : PHP, JavaScript
|
|
 |
 |
 |
 |
Date :
2014-02-11 09:18:01 |
By :
ZeedzarD |
View :
1075 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |