Mandatory Sections
This commit is contained in:
@ -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) => {
|
||||
|
Reference in New Issue
Block a user