|
@@ -8,6 +8,19 @@ exceltoxlxstream = async function (file) {
|
|
|
const data = new Uint8Array(e.target.result);
|
|
|
const workbook = XLSX.read(data, { type: 'array' });
|
|
|
const fileStream = XLSX.write(workbook, { type: 'array', bookType: 'xlsx' });
|
|
|
+ const blob = new Blob([fileStream], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
|
|
+ const url = URL.createObjectURL(blob);
|
|
|
+ // 创建隐藏的下载链接并点击
|
|
|
+ const downloadLink = document.createElement('a');
|
|
|
+ downloadLink.href = url;
|
|
|
+ downloadLink.download = file.name;
|
|
|
+ downloadLink.style.display = 'none';
|
|
|
+ document.body.appendChild(downloadLink);
|
|
|
+ downloadLink.click();
|
|
|
+ document.body.removeChild(downloadLink);
|
|
|
+
|
|
|
+ // 释放资源
|
|
|
+ URL.revokeObjectURL(url);
|
|
|
resolve(fileStream);
|
|
|
};
|
|
|
reader.readAsArrayBuffer(file);
|