diff --git a/demo/demo28.ts b/demo/demo28.ts index b7eab7b919..366227102a 100644 --- a/demo/demo28.ts +++ b/demo/demo28.ts @@ -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) => { diff --git a/demo/demo29.ts b/demo/demo29.ts index 8a5bc3fc03..10a3318e03 100644 --- a/demo/demo29.ts +++ b/demo/demo29.ts @@ -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) => {