Update demos

This commit is contained in:
Dolan
2018-09-13 01:54:37 +01:00
parent f1b176670c
commit a9167b4809
2 changed files with 27 additions and 6 deletions

View File

@ -5,12 +5,20 @@ import { Document, Packer, Paragraph, VerticalAlign } from "../build";
const doc = new Document();
const table = doc.createTable(4, 4);
const table = doc.createTable(2, 2);
table
.getCell(2, 2)
.getCell(1, 1)
.addContent(new Paragraph("This text should be in the middle of the cell"))
.CellProperties.setVerticalAlign(VerticalAlign.CENTER);
table
.getCell(1, 0)
.addContent(
new Paragraph(
"Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah",
).heading1(),
);
const packer = new Packer();
packer.toBuffer(doc).then((buffer) => {

View File

@ -5,20 +5,33 @@ import { Document, Packer, Paragraph } from "../build";
const doc = new Document();
const table = doc.createTable(2, 2);
table
doc
.createTable(2, 2)
.getCell(0, 0)
.addContent(new Paragraph("Hello"))
.setHorizontalSpan(2);
doc.createParagraph("Another table").heading2();
const table2 = doc.createTable(2, 3);
table2
doc
.createTable(2, 3)
.getCell(0, 0)
.addContent(new Paragraph("World"))
.setHorizontalSpan(3);
doc.createParagraph("Another table").heading2();
const table = doc.createTable(2, 4);
table
.getCell(0, 0)
.addContent(new Paragraph("Foo"))
.setHorizontalSpan(4);
table.getCell(1, 0).addContent(new Paragraph("Bar1"));
table.getCell(1, 1).addContent(new Paragraph("Bar2"));
table.getCell(1, 2).addContent(new Paragraph("Bar3"));
table.getCell(1, 3).addContent(new Paragraph("Bar4"));
const packer = new Packer();
packer.toBuffer(doc).then((buffer) => {