简体   繁体   English

Nodejs docx-merger 插件“Word 发现不可读的内容”

[英]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.

相关问题 NodeJS 使用 Buffer.concat() 合并 Docx 文件给出了“发现不可读内容的单词” - NodeJS Merge Docx Files Using Buffer.concat() gives "word found unreadable content" html-docx-js package 产生不可读的内容 - html-docx-js package produces unreadable content 使用 NodeJS 和 Electron 使用操作系统的默认应用程序(带有 Word 的 docx 等)打开外部文件 - Open external file with OS' default application (docx with Word, etc.) using NodeJS and Electron 如何使用 NodeJS 将 PDF 转换为 DOCX 或将 URL 转换为 DOCX? - How to convert PDF to DOCX or URL to DOCX with NodeJS? unescape将汉字转换为不可读的内容 - unescape converting Chinese characters to unreadable content Grunt Sass 错误:未找到或无法读取要导入的文件 - Grunt Sass Error: File to import not found or unreadable JQuery 插件 - 突出显示包含某个单词的内容可编辑框 - JQuery Plugin - Highlighting a content editable box that contains a certain word 在网页上阅读Word / .docx文档 - Read Word/.docx Documents on a webpage 将网页下载为Word文档(docx) - Download webpage as Word document (docx) 未找到或无法读取要导入的文件:node_modules/bootstrap/scss/functions - File to import not found or unreadable: node_modules/bootstrap/scss/functions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM