excel二进制流输出(ArrayBuffer)

这篇博客探讨了如何利用ArrayBuffer处理Excel文件的二进制流,将其转换为二进制数组,以便进行进一步操作。内容引用了相关的在线资源链接,提供详细解析。

ArrayBuffer主要将二进制码转译为二进制数组

    const uInt8Array = new Uint8Array(content); //先将返回的二进制数组转化为js的二进制数组
    const blob=new Blob([uInt8Array],{type:"application/vnd.ms-excel"});//然后创建blob对象,文件类型设置为excel的类型
    const blobURL = window.URL.createObjectURL(blob);//然后创建一个可访问的URL
    const tempLink = document.createElement('a');//创建a标签去下载
    tempLink.style.display = 'none';
    tempLink.href = blobURL;
    tempLink.setAttribute('download', fileName+".xlsx");
    if (typeof tempLink.download === 'undefined') {
        tempLink.setAttribute('target', '_blank');
    }
     document.body.appendChild(tempLink);
     tempLink.click();
     document.body.removeChild(tempLink);
     window.URL.revokeObjectURL(blobURL);

详细查看(ArrayBuffer)http://www.freesion.com/article/442667984/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值