Turn Run into a declaritive API
This commit is contained in:
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user