1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| <html> <script src="./node_modules/docx-merger/dist/docx-merger.min.js"></script> <script src="https://cdn.bootcdn.net/ajax/libs/FileSaver.js/2.0.5/FileSaver.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip-utils/0.0.2/jszip-utils.min.js"></script> <script> function loadFile(url, callback) { JSZipUtils.getBinaryContent(url, callback); } loadFile("template.docx", function (error, file1) { loadFile("template1.docx", function (error, file2) { var docx = new DocxMerger({}, [file1, file2]); docx.save('blob', function (data) { saveAs(data, "output.docx"); }); }) }) </script> </html>
|