Use new Paragraph API

This commit is contained in:
Dolan
2019-06-13 22:36:42 +01:00
parent 5497dabaf9
commit a1cd5e9573

View File

@ -1,7 +1,7 @@
// Example on how to customise the look at feel using Styles // Example on how to customise the look at feel using Styles
// Import from 'docx' rather than '../build' if you install from npm // Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs"; import * as fs from "fs";
import { Document, Packer, Paragraph, TextRun, HeadingLevel } from "../build"; import { Document, HeadingLevel, Packer, Paragraph, TextRun } from "../build";
const doc = new Document({ const doc = new Document({
creator: "Clippy", creator: "Clippy",
@ -73,8 +73,24 @@ doc.addParagraph(
}, },
}), }),
); );
doc.addParagraph(new Paragraph("Option5 -- override 2 to 5").setNumbering(letterNumbering5, 0)); doc.addParagraph(
doc.addParagraph(new Paragraph("Option3").setNumbering(letterNumbering, 0)); new Paragraph({
text: "Option5 -- override 2 to 5",
numbering: {
num: letterNumbering,
level: 0,
},
}),
);
doc.addParagraph(
new Paragraph({
text: "Option3",
numbering: {
num: letterNumbering,
level: 0,
},
}),
);
doc.addParagraph(new Paragraph({}).addRun(new TextRun("Some monospaced content").font("Monospace"))); doc.addParagraph(new Paragraph({}).addRun(new TextRun("Some monospaced content").font("Monospace")));