work on docx patcher

This commit is contained in:
Dolan Miu
2023-02-16 20:17:48 +00:00
parent ffd998cbf5
commit c206d23480
5 changed files with 31 additions and 3 deletions

View File

@ -1,8 +1,10 @@
// Simple template example
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { fromDocx } from "../build";
import { Paragraph, patchDocument, TextRun } from "../build";
fromDocx(fs.readFileSync("demo/template.docx")).then((doc) => {
patchDocument(fs.readFileSync("demo/assets/simple-template.docx"), {
children: [new Paragraph("ff"), new TextRun("fgf")],
}).then((doc) => {
fs.writeFileSync("My Document.docx", doc);
});