Turn Run into a declaritive API

This commit is contained in:
Dolan
2019-06-17 01:51:57 +01:00
parent a1cd5e9573
commit fb65bb4207
27 changed files with 411 additions and 183 deletions

View File

@ -5,18 +5,35 @@ import { Document, Packer, Paragraph, TextRun } from "../build";
const doc = new Document();
const paragraph1 = new Paragraph().bidirectional();
const textRun1 = new TextRun("שלום עולם").rightToLeft();
const paragraph1 = new Paragraph({
bidirectional: true,
});
const textRun1 = new TextRun({
text: "שלום עולם",
rightToLeft: true,
});
paragraph1.addRun(textRun1);
doc.addParagraph(paragraph1);
const paragraph2 = new Paragraph().bidirectional();
const textRun2 = new TextRun("שלום עולם").bold().rightToLeft();
const paragraph2 = new Paragraph({
bidirectional: true,
});
const textRun2 = new TextRun({
text: "שלום עולם",
bold: true,
rightToLeft: true,
});
paragraph2.addRun(textRun2);
doc.addParagraph(paragraph2);
const paragraph3 = new Paragraph().bidirectional();
const textRun3 = new TextRun("שלום עולם").italics().rightToLeft();
const paragraph3 = new Paragraph({
bidirectional: true,
});
const textRun3 = new TextRun({
text: "שלום עולם",
italics: true,
rightToLeft: true,
});
paragraph3.addRun(textRun3);
doc.addParagraph(paragraph3);