# Paragraph Class

> 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.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Class
- **Introduced:** 15.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WPF.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl > Paragraph Class
- **1827 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraph/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraph/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraph/llms-full.txt

---

### Description

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](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/paragraphs-property/llms-full.txt) property.

### Syntax

```csharp
public class Paragraph
```

```vbnet
Public Class Paragraph
```

### Examples

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.

```csharp
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;
        }
}
```

```vbnet
Dim numberedParagraphFormat As New TXTextControl.ParagraphFormat(TXTextControl.HorizontalAlignment.Left)
numberedParagraphFormat.Alignment = TXTextControl.HorizontalAlignment.Left
numberedParagraphFormat.KeepLinesTogether = True
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
Next
```

The following example examines the first paragraph in a short document.

```csharp
textControl.Text = "Quarterly results\nRevenue increased by 12%.";
Paragraph paragraph = textControl.Paragraphs[1];
```

```vbnet
textControl.Text = "Quarterly results" & vbCrLf & "Revenue increased by 12%."
Dim paragraph As Paragraph = textControl.Paragraphs(1)
```

---

## In This Section

- [Paragraph.Format Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraph/format-property/llms-full.txt): Gets or sets the paragraph's formatting attributes. The property's value is an object of the type ParagraphFormat.
- [Paragraph.FormattingStyle Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraph/formattingstyle-property/llms-full.txt): Gets or sets the paragraph's formatting style. The specified style must be the name of a style contained in the ParagraphStyles collection of a Text Control document.
- [Paragraph.Length Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraph/length-property/llms-full.txt): Gets the number of characters in the paragraph including the paragraph end character.
- [Paragraph.Lines Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraph/lines-property/llms-full.txt): Gets the number of lines the paragraph consists of.
- [Paragraph.ListFormat Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraph/listformat-property/llms-full.txt): Gets or sets the paragraph's bulleted or numbered list and/or its formatting attributes. The property's value is an object of the type ListFormat.
- [Paragraph.ListNumber Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraph/listnumber-property/llms-full.txt): Gets the paragraph's list number. It is zero, if the paragraph does not belong to a numbered list.
- [Paragraph.ListNumberText Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraph/listnumbertext-property/llms-full.txt): Gets the paragraph's list number text. The text consists of the text in front of the number, the number itself and the text behind the list number. It is an empty string, if the paragraph does not belong to a numbered list.
- [Paragraph.Number Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraph/number-property/llms-full.txt): Gets the paragraph's number. The first paragraph has the number 1.
- [Paragraph.Save Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraph/save-method/llms-full.txt): Saves the paragraph's text with the specified format.
- [Paragraph.Select Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraph/select-method/llms-full.txt): Selects the paragraph. The paragraph break characters bounding the paragraph are not selected.
- [Paragraph.Start Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraph/start-property/llms-full.txt): Gets the number (one-based) of the paragraph's first character.
- [Paragraph.StartLine Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraph/startline-property/llms-full.txt): Gets the number (one-based) of the paragraph's first line.
- [Paragraph.Text Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraph/text-property/llms-full.txt): Gets the paragraph's text.

---

## Nearby

- **Previous:** [PaperSize.Width Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/papersize/width-property/llms-full.txt)
- **Next:** [Paragraph.Format Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraph/format-property/llms-full.txt)
