This commit is contained in:
chenjianan
2019-05-15 15:17:15 +08:00
parent 45b91a958b
commit 82590a9718
7 changed files with 2162 additions and 11 deletions

View File

@@ -11,6 +11,11 @@ const tableToExcel = (function() {
return function(table, filename, sheetname) {
if (!table.nodeType) table = document.getElementById(table)
const ctx = { worksheet: sheetname || 'Worksheet', table: table.innerHTML }
const blob = new Blob([format(template, ctx)])
if ('msSaveOrOpenBlob' in navigator) {
window.navigator.msSaveOrOpenBlob(blob, filename + '.xls')
return
}
const aTag = document.createElement('a')
aTag.href = uri + base64(format(template, ctx))
aTag.download = filename