# Line Class

> An instance of the Line class represents a single line in a Text Control document.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Class
- **Introduced:** 10.1
- **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 > Line Class
- **1127 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/line/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/line/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/line/llms-full.txt

---

### Description

An instance of the Line class represents a single line in a Text Control document.

### Syntax

```csharp
public class Line
```

```vbnet
Public Class Line
```

### Examples

The following example shows how to read the document line by line.

```csharp
textControl1.Text = "Line 1\nLine 2\nLine 3";

foreach (TXTextControl.Line line in textControl1.Lines)
{
    Console.WriteLine("Line #" + line.Number.ToString() + " starts at: " +
        line.Start.ToString() + ". Text: " + line.Text);
}
```

```vbnet
TextControl1.Text = "Line 1" + vbCrLf + "Line 2" + vbCrLf + "Line 3"

For Each line As TXTextControl.Line In TextControl1.Lines
    Console.WriteLine("Line #" + line.Number.ToString() + " starts at: " + _
            line.Start.ToString() + ". Text: " + line.Text)
Next
```

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

```csharp
textControl.Text = "Quarterly results\nRevenue increased by 12%.";
Line line = textControl.Lines[1];
```

```vbnet
textControl.Text = "Quarterly results" & vbCrLf & "Revenue increased by 12%."
Dim line As Line = textControl.Lines(1)
```

---

## In This Section

- [Line.Baseline Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/line/baseline-property/llms-full.txt): Gets the line's baseline position. The value is given in twips with an origin at the upper left corner of the document. The relationship between the upper left corner of the document and the upper left corner of the visible portion of the document can be obtained with the TextControl.ScrollLocation property.
- [Line.Length Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/line/length-property/llms-full.txt): Gets the number of characters in the line including the break character.
- [Line.Number Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/line/number-property/llms-full.txt): Gets the line's number. The first line has the number 1.
- [Line.Page Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/line/page-property/llms-full.txt): Gets the number of the page to which the line belongs. The first page has the number 1.
- [Line.Save Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/line/save-method/llms-full.txt): Saves the line's text with the specified format.
- [Line.Start Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/line/start-property/llms-full.txt): Gets the number (one-based) of the first character in the line.
- [Line.Text Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/line/text-property/llms-full.txt): Gets the line's text.
- [Line.TextBounds Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/line/textbounds-property/llms-full.txt): Gets the bounding rectangle of the text belonging to the line. The values are given in twips with an origin at the upper left corner of the document. The relationship between the upper left corner of the document and the upper left corner of the visible portion of the document can be obtained with the TextControl.ScrollLocation property.

---

## Nearby

- **Previous:** [LicenseLevelException Constructor](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/licenselevelexception/constructor/llms-full.txt)
- **Next:** [Line.Baseline Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/line/baseline-property/llms-full.txt)
