$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
RichTextBox Control for Windows Forms
Edit rich text content with text formatting options, mail-merge, table, and floating objects, etc.
Home > WinForms UI Controls > User Manual > RichTextBox Paragraph Element in C#

Paragraph of KetticDocument in RichTextBox in C#.NET

KetticRichTextBox control contains the paragraph C# class for the users to separate the content of KetticDocument into paragraphs. The paragraphs are used to display the inline elements, including Span, HyperlinkRangeStart, HyperlinkRangeEnd, InlineImage, and more. The paragraph C# class provides various parameters for the users to customize the appearance of the paragraph in KetticDocument. The following article demonstrates how to use the paragraph C# class.

Apply Paragraph Element to Context in KetticDocument

KetticRichTextBox control applies the Paragraph element only into the context of a Section or a TableCell element in KetticDocument. The users can add the paragraphs to the section by using the collection of Blocks as the C# code below.

Section section = new Section();
Paragraph paragraph = new Paragraph();
section.Blocks.Add(paragraph);
this.ketticRichTextBox1.Document.Sections.Add(section);

Add Inline Elements to a Paragraph

The paragraph element of the KetticDocument allows the users to add inline elements to the paragraph including Span, HyperlinkRangeStart, HyperlinkRangeEnd, or InlineImage and more. This is achieved through using the Inlines collection of the Paragraph. The C# code below shows how to achieve this.

Section sect = new Section();
Paragraph para = new Paragraph();
Span span = new Span("Span");
para.Inlines.Add(span);
sect.Blocks.Add(para);
this.ketticRichTextBox1.Document.Sections.Add(sect);

Properties for Customizing the Paragraph in KetticDocument

The Paragraph C# class contains a variety of properties for the users to customize the layout of the elements placed under the paragraph in KetticDocument.
  • LineSpacing, this property is used to set the value for the space between the lines.
  • FontSize, this property is used to adjust the font size of the text within the Paragraph. The child elements of the paragraph inherit the settings when there is no specified setting.
  • LeftIndent, this property is used to set the indent size to the left of the Paragraph and the indent will be applied with the respective margins to the layout.
  • RightIndent, this property is used to set the indent size to the right of the Paragraph and the indent will be applied with the respective margins to the layout.
  • LineSpacingType, this property is used to determine the type of spacing. There are three modes available to this property, AtLeast, Auto, and Exact. The AtLeast mode determines the space between the lines that will be equal or greater than the value of the LineSpacing property. The Auto mode determines the space between the lines automatically. And the Exact mode determines the space between the lines that will be equal to the value of the LineSpacing property.
  • SpacingAfter, this property is able to set the space after the paragraph.
  • TextAlignment, this property is used to adjust the alignment of the text within a paragraph
  • SpacingBefore, this property is able to set the space before the paragraph
UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls