[英]Nodejs docx-merger plugin “Word found unreadable content”
I'm trying to merge docx files via docx-merger
library.我正在尝试通过
docx-merger
库合并 docx 文件。 Everything is good, except of Microsoft Word's "Word found unreadable content in output.docx. Do you want to recover the contents of this document? If you trust the source of this document, click Yes."
一切都很好,除了 Microsoft Word 的
"Word found unreadable content in output.docx. Do you want to recover the contents of this document? If you trust the source of this document, click Yes."
message.信息。 It opens the document when click to yes, but not the output file, just a buffer.
单击“是”时会打开文档,但不会打开 output 文件,只是一个缓冲区。
Here is my code:这是我的代码:
const docxMerger = require('docx-merger');
fs.readdir('input/', (err, bufferFiles) => {
var bufferFilesArr = [];
bufferFiles.forEach(bufferFile => {
var file = fs.readFileSync(path.resolve('app/temps/buffer',bufferFile), 'binary');
bufferFilesArr.push(file);
});
var mergedDocx = new docxMerger({}, bufferFilesArr);
mergedDocx.save('nodebuffer', function(data){{
fs.writeFileSync(path.resolve('output','output.docx'), data, 'utf8',function(err){
//callback
});
}});
});
I'm trying here to merge docx
files which are in the input
folder.我在这里尝试合并
input
文件夹中的docx
文件。
It merges all of them, but I can not open file without this message.它合并了所有这些,但没有此消息我无法打开文件。
Header & footer sections is the cause for this issue. Header 和页脚部分是导致此问题的原因。 Try removing the header and footer sections in the documents.
尝试删除文档中的 header 和页脚部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.