function formattable(tableHtml,sheetName) {
var template = '
/head>{table}
';
var ctx = {
ワークシート : 名前,
テーブル : tableHtml
};
var downloadLink = document.createElement("a");
downloadLink.href = 'data:application/vnd.ms-excel;base64,'base64(format(
template, ctx));
downloadLink.download = シート名 ".xls";
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
// window.open('data:application/vnd.ms-excel;base64,'
// Base64(format(template, ctx)));
}
functionbase64(s) {
return $.base64.btoa(unescape(encodeURIComponent(s)));
}
var format = function(s, c) {
return s.replace(/{(w )}/g, function(m, p) {
c[p] を返す
});
}