Files
docx-js/demo/85-template-document.ts
2023-02-16 20:17:48 +00:00

11 lines
381 B
TypeScript

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