adds textDirection to table cells

This commit is contained in:
bs595r
2020-05-10 10:36:25 -07:00
parent 3eca81d3f5
commit 25a7ce3742
5 changed files with 93 additions and 3 deletions

View File

@ -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, Table, TableCell, TableRow, VerticalAlign } from "../build";
import { Document, HeadingLevel, Packer, Paragraph, Table, TableCell, TableRow, VerticalAlign, TextDirection } from "../build";
const doc = new Document();
@ -17,6 +17,14 @@ const table = new Table({
children: [new Paragraph({}), new Paragraph({})],
verticalAlign: VerticalAlign.CENTER,
}),
new TableCell({
children: [new Paragraph({text: "bottom to top"}), new Paragraph({})],
textDirection: TextDirection.BOTTOMTOTOPLEFTTORIGHT
}),
new TableCell({
children: [new Paragraph({text: "top to bottom"}), new Paragraph({})],
textDirection: TextDirection.TOPTOBOTTOMRIGHTTOLEFT
}),
],
}),
new TableRow({
@ -38,6 +46,22 @@ const table = new Table({
],
verticalAlign: VerticalAlign.CENTER,
}),
new TableCell({
children: [
new Paragraph({
text: "Text above should be vertical from bottom to top",
}),
],
verticalAlign: VerticalAlign.CENTER,
}),
new TableCell({
children: [
new Paragraph({
text: "Text above should be vertical from top to bottom",
}),
],
verticalAlign: VerticalAlign.CENTER,
}),
],
}),
],