The paragraph class allows you to separate the content into paragraphs. It is responsible for displaying inline elements such as Span, HyperlinkRangeStart and End, InlineImage etc. You are also able to configure the appearance of the paragraph by modifying its parameters.
This topic will explain you how to:
The Paragraph can be used only in the context of a Section or a TableCell element. The section exposes a collection of Blocks, to which the paragraphs can be added.
Section section = new Section(); Paragraph paragraph = new Paragraph(); section.Blocks.Add(paragraph); this.radRichTextBox1.Document.Sections.Add(section);
Dim section As New Section() Dim paragraph As New Paragraph() section.Blocks.Add(paragraph) Me.RadRichTextBox1.Document.Sections.Add(section)
To add inline elements such as Span, HyperlinkRangeStart and End, or InlineImage you have to use the Inlines collection of the Paragraph.
Section sect = new Section(); Paragraph para = new Paragraph(); Span span = new Span("Span declared in code-behind"); para.Inlines.Add(span); sect.Blocks.Add(para); this.radRichTextBox1.Document.Sections.Add(sect);
Dim sect As New Section() Dim para As New Paragraph() Dim span As New Span("Span declared in code-behind") para.Inlines.Add(span) sect.Blocks.Add(para) Me.RadRichTextBox1.Document.Sections.Add(sect)
The Paragraph exposes several properties that allow you to customize the layout of the elements placed underneath it. Here is a list of them:
FontSize - represents the font size of the text inside the Paragraph. If not explicitly set to its child elements, they inherit its value.
LineSpacing - specifies the value for the space between the lines.
LineSpacingType - specifies the type of spacing:
AtLeast - the space between the lines should equal or greater than the value of the LineSpacing property.
Auto - the space between the lines is determined automatically.
Exact - the space between the lines should equal to the value of the LineSpacing property.
LeftIndent - represents the size of the indent to the left size of the Paragraph. The indent gets applied together with the respective margins to the layout.
RightIndent - represents the size of the indent to the right size of the Paragraph. The indent gets applied together with the respective margins to the layout.
SpacingAfter - represents the size of the empty space after the Paragraph.
SpacingBefore - represents the size of the empty space before the Paragraph.
TextAlignment - represents the alignment of the text inside the Paragraph.