Declarative tables
This commit is contained in:
@ -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],
|
||||
});
|
||||
|
Reference in New Issue
Block a user