Add Convenience functions

This commit is contained in:
Dolan
2020-12-24 03:37:43 +00:00
parent ef12ada5d7
commit 502db14bba
15 changed files with 115 additions and 49 deletions

View File

@ -1,7 +1,7 @@
// Example on how to customise the look at feel using Styles
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { AlignmentType, Document, HeadingLevel, Packer, Paragraph, TextRun, UnderlineType } from "../build";
import { AlignmentType, convertInchesToTwip, Document, HeadingLevel, Packer, Paragraph, TextRun, UnderlineType } from "../build";
const doc = new Document({
creator: "Clippy",
@ -56,7 +56,7 @@ const doc = new Document({
},
paragraph: {
indent: {
left: 720,
left: convertInchesToTwip(0.5),
},
spacing: {
line: 276,
@ -168,8 +168,7 @@ doc.addSection({
text: "Strong Style",
}),
new TextRun({
text:
" - Very strong.",
text: " - Very strong.",
}),
],
}),