Mandatory Sections

This commit is contained in:
Dolan Miu
2019-07-31 08:48:02 +01:00
parent bf80311ef7
commit ac5b15d0e3
63 changed files with 1194 additions and 1588 deletions

View File

@ -1,7 +1,7 @@
// Example of how you would create a table and add data to it
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { Document, HeadingLevel, Packer, Paragraph, VerticalAlign, Table } from "../build";
import { Document, HeadingLevel, Packer, Paragraph, Table, VerticalAlign } from "../build";
const doc = new Document();
@ -10,8 +10,6 @@ const table = new Table({
columns: 2,
});
doc.add(table);
table
.getCell(1, 1)
.add(new Paragraph("This text should be in the middle of the cell"))
@ -25,6 +23,10 @@ table.getCell(1, 0).add(
}),
);
doc.addSection({
children: [table],
});
const packer = new Packer();
packer.toBuffer(doc).then((buffer) => {