# ParagraphFormat.WidowOrphanLines Property

> Gets or sets the number of lines for widow/orphan control. Widow/orphan control avoids that a paragraph is started at the bottom of a page and that either, the majority of its lines, or only a few lines are displayed on the next page. This property's value determines how many lines must not be separated from the rest of the paragraph. For example, if this property is set to two, there must be at least three lines of the paragraph at the bottom of the previous page and at least three lines at the top of the next page. Otherwise, the complete paragraph is displayed on the next page. If this property is set to zero, widow/orphan control is disabled.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Property
- **Introduced:** 13.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WinForms.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 Windows Forms > Reference > TXTextControl > ParagraphFormat.WidowOrphanLines Property
- **754 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/paragraphformat/widoworphanlines-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/paragraphformat/widoworphanlines-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/paragraphformat/widoworphanlines-property/llms-full.txt

---

### Description

Gets or sets the number of lines for widow/orphan control. Widow/orphan control avoids that a paragraph is started at the bottom of a page and that either, the majority of its lines, or only a few lines are displayed on the next page. This property's value determines how many lines must not be separated from the rest of the paragraph. For example, if this property is set to two, there must be at least three lines of the paragraph at the bottom of the previous page and at least three lines at the top of the next page. Otherwise, the complete paragraph is displayed on the next page. If this property is set to zero, widow/orphan control is disabled.

### Syntax

```csharp
public int WidowOrphanLines { get; set; }
```

```vbnet
Public Property WidowOrphanLines As Integer
```

### Examples

The following example applies paragraph layout to selected report text by using `ParagraphFormat.WidowOrphanLines`.

```csharp
textControl.Text = "First item\nSecond item\nThird item";
textControl.Select(0, textControl.Text.Length);
ParagraphFormat paragraphFormat = textControl.Selection.ParagraphFormat;

paragraphFormat.WidowOrphanLines = 100;
Console.WriteLine($"Widow Orphan Lines used by Paragraph Format: {paragraphFormat.WidowOrphanLines}");

textControl.Selection.ParagraphFormat = paragraphFormat;
```

```vbnet
textControl.Text = "First item" & vbCrLf & "Second item" & vbCrLf & "Third item"
textControl.Select(0, textControl.Text.Length)
Dim paragraphFormat As ParagraphFormat = textControl.Selection.ParagraphFormat

paragraphFormat.WidowOrphanLines = 100
Console.WriteLine($"Widow Orphan Lines used by Paragraph Format: {paragraphFormat.WidowOrphanLines}")

textControl.Selection.ParagraphFormat = paragraphFormat
```

### Limitations

The property's value must be between 0 and 3.

### Remarks

The property's default value is 0.

The property returns its default value when the text selection contains multiple paragraphs with mixed setting. The [Selection.IsCommonValueSelected](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/iscommonvalueselected-method/llms-full.txt) method can be used to check for mixed attributes.

---

## Nearby

- **Previous:** [ParagraphFormat.TopDistance Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/paragraphformat/topdistance-property/llms-full.txt)
- **Next:** [ParagraphStyle Class](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/paragraphstyle/llms-full.txt)
