When the contents of multiple WORD documents are merged, only the contents of the first WORD will be written to the new WORD document inside, while the other WORD contents are missing.
var fs= require('fs'); var bufferhelper=require('bufferhelper'); var bh= new bufferhelper(); for(var i=0; i<5; Icaga) bracket Vardata = fs.readfilesync ('./public/type/xz' plus xz[i] plus'. doc'); bh.concat(data); bracket fs.writeFileSync('./public/type/jz.doc',bh.toBuffer());
After the above code is run, the content of jz.doc inside is only xz1.doc, but the content of xz2-5 WORD file is missing.
Word document format needs parsing and cannot be directly spliced like common text files.
PS: NodeJS should not have a good library for parsing Word document format, or use other languages, such as C# or java