In most cases, text can be provided during the construction of a paragraph. The text will inherit the default paragraph style defined in the document.
section.Paragraph("Hello Word!");
The Paragraph method returns a descriptor that allows further customization
of its contents.
section.Paragraph("Text with blue color").FontColor("#0000FF");
section.Paragraph("Bold and underlined text").Bold().Underline();
section.Paragraph("Centered small text").FontSize(12).AlignCenter();
Text with blue color
Bold and underlined text
Centered small text
The contents of a paragraph can also be constructed using a builder function. This makes it possible to format specific runs of text:
section.Paragraph(p =>
{
p.Text("The ");
p.Text("chemical formula").Underline();
p.Text(" of ");
p.Text("sulfuric acid").Highlight();
p.Text(" is H");
p.Text("2").Subscript();
p.Text("SO");
p.Text("4").Subscript();
p.Text(".");
});
The chemical formula of sulfuric acid is H 2 SO 4 .