js前端base64转word并下载
作者:
爱代码的派派星 | 来源:发表于
2020-08-24 21:16 被阅读0次代码如下
var raw = window.atob(ba);
var uInt8Array = new Uint8Array(raw.length);
for (var i = 0; i < raw.length; i++) {
uInt8Array[i] = raw.charCodeAt(i);
}
const link = document.createElement("a");
const blob = new Blob([uInt8Array],{
// type: 'application/vnd.ms-excel'
type: 'application/msword'
})
link.style.display = 'none';
link.href = URL.createObjectURL(blob);
//link.setAttribute('download','对比结果_'+$scope.你的变量+'.xls');
link.setAttribute('download','对比结果');
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
本文标题:js前端base64转word并下载
本文链接:https://www.haomeiwen.com/subject/mstxjktx.html
网友评论