An instance of the Paragraph class represents a single paragraph in a Text Control document. Paragraphs are numbered from the beginning to the end of the document beginning with 1. A document has at least one paragraph. A Paragraph object can be obtained from the paragraphs collection available through the TextControl.Paragraphs property.


public class Paragraph
Public Class Paragraph

Introduced: 15.0.


The following example shows how to use the Paragraph class to add paragraph numbers and apply a format to each paragraph, that holds text, e.g. is longer than 3 characters.

TXTextControl.ParagraphFormat numberedParagraphFormat = new TXTextControl.ParagraphFormat();

numberedParagraphFormat.Alignment     = TXTextControl.HorizontalAlignment.Left;
numberedParagraphFormat.LeftIndent    = 200;
numberedParagraphFormat.RightIndent   = 500;
numberedParagraphFormat.HangingIndent = 100;

foreach (TXTextControl.Paragraph p in textControl1.Paragraphs)
    textControl1.InputPosition = new TXTextControl.InputPosition(p.Start - 1);
        if (p.Length >= 3)
            textControl1.Selection.Text = p.Number.ToString() + ". ";
            p.Format = numberedParagraphFormat;
Dim numberedParagraphFormat As New TXTextControl.ParagraphFormat(TXTextControl.HorizontalAlignment.Left)

numberedParagraphFormat.Alignment     = TXTextControl.HorizontalAlignment.Left
numberedParagraphFormat.LeftIndent    = 200
numberedParagraphFormat.RightIndent   = 500
numberedParagraphFormat.HangingIndent = 100

For Each p As TXTextControl.Paragraph In TextControl1.Paragraphs
    TextControl1.InputPosition = New TXTextControl.InputPosition(p.Start - 1)
    If p.Length >= 3 Then
        TextControl1.Selection.Text = p.Number.ToString() + ". "
        p.Format = numberedParagraphFormat
    End If


Method Description
Save Saves the paragraph's text with the specified format.
Select Selects the paragraph.


Property Description
Format Gets or sets the paragraph's formatting attributes.
FormattingStyle Gets or sets the paragraph's formatting style.
Length Gets the number of characters in the paragraph including the paragraph end character.
Lines Gets the number of lines the paragraph consists of.
ListFormat Gets or sets the paragraph's bulleted or numbered list and/or its formatting attributes.
ListNumber Gets the paragraph's list number.
ListNumberText Gets the paragraph's list number text.
Number Gets the paragraph's number.
Start Gets the number (one-based) of the paragraph's first character.
StartLine Gets the number (one-based) of the paragraph's first line.
Text Gets the paragraph's text.