Files
docx-js/demo/15-page-break-before.ts

21 lines
507 B
TypeScript
Raw Normal View History

2018-08-21 02:46:21 +01:00
// Page break before example
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { Document, Packer, Paragraph } from "../build";
const doc = new Document();
2019-07-31 08:48:02 +01:00
doc.addSection({
children: [
new Paragraph("Hello World"),
new Paragraph({
text: "Hello World on another page",
pageBreakBefore: true,
}),
],
2019-06-13 01:07:00 +01:00
});
2018-08-21 02:46:21 +01:00
2019-08-07 22:12:14 +01:00
Packer.toBuffer(doc).then((buffer) => {
2018-08-21 02:46:21 +01:00
fs.writeFileSync("My Document.docx", buffer);
});