docxtemplater 的构造函数的第一个参数必须是有效的 zip 文件

问题描述

大家下午好,我正在使用 Docxtemplater 库及其 FileSaver.min.jsjszip-utils.js 库(来自 { {3}})。

这就是我所做的:

let btnPrint.on("click",function (){
    getWordTemplate();
})

const getWordTemplate = () => {
   loadFile("text.docx",(err,content) => {
       if (err) {
           showAlert("Impossibile leggere il file","warning");
       } else {
           const doc = new Docxtemplater(content);
           doc.setData({
               "first_name": "Hipp","last_name": "Edgar","phone": "0652455478","description": "New Website"
           });
           doc.render();
           const out = doc.getZip().generate({type:"blob"});
           saveAs(out,"output.docx");
       }
   });
}

问题是 chrome 控制台给了我这个错误

docxtemplater 的构造函数的第一个参数必须是一个有效的 zip 文件(jszip v2 或 pizzip v3)

怎么了?如何解决这个问题?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)