1.1 KiB
1.1 KiB
Text
Paragraphs need text run
objects. To create text:
var text = new docx.TextRun("My awesome text here for my university dissertation");
paragraph.addRun(text);
Text objects have methods inside which changes the way the text is displayed.
Typographical Emphasis
More info here
Bold
text.bold();
Italics
text.italic();
Underline
text.underline();
Strike through
text.strike();
Double strike through
text.doubleStrike();
Superscript
text.superScript();
Subscript
text.subScript();
All Capitals
text.allCaps();
Small Capitals
text.smallCaps();
Break
Sometimes you would want to put text underneath another line of text but inside the same paragraph.
text.break();
Chaining
What if you want to create a paragraph which is bold and italic?
paragraph.bold().italic();