function formattable(tableHtml, sheetName) {
var template = '
< /head>
';
var ctx = {
Arbeitsblatt: Name,
Tabelle: TableHtml
};
var downloadLink = document.createElement("a");
downloadLink.href = 'data:application/vnd.ms-excel;base64,' base64(format(
template, ctx));
downloadLink.download = sheetName ".xls";
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
// window.open('data:application/vnd.ms-excel;base64,'
// base64(format(template, ctx)));
}
function base64(s) {
return $.base64.btoa(unescape(encodeURIComponent(s)));
}
var format = function(s, c) {
return s.replace(/{(w )}/g, function(m, p) {
return c[p];
});
}