Declarative tables

This commit is contained in:
Dolan
2019-09-13 00:51:20 +01:00
parent 59fc1ed632
commit 418adca9f3
21 changed files with 978 additions and 536 deletions

View File

@ -9,15 +9,35 @@ import {
RelativeVerticalPosition,
Table,
TableAnchorType,
TableCell,
TableLayoutType,
TableRow,
WidthType,
} from "../build";
const doc = new Document();
const table = new Table({
rows: 2,
columns: 2,
rows: [
new TableRow({
children: [
new TableCell({
children: [new Paragraph("Hello")],
columnSpan: 2,
}),
],
}),
new TableRow({
children: [
new TableCell({
children: [],
}),
new TableCell({
children: [],
}),
],
}),
],
float: {
horizontalAnchor: TableAnchorType.MARGIN,
verticalAnchor: TableAnchorType.MARGIN,
@ -29,9 +49,6 @@ const table = new Table({
layout: TableLayoutType.FIXED,
});
table.getCell(0, 0).add(new Paragraph("Hello"));
table.getRow(0).mergeCells(0, 1);
doc.addSection({
children: [table],
});