Line Class
- Namespace
TXTextControl
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. Core. SDK
- Assembly
TXTextControl.Core. dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. Core. SDK TXTextControl.from the setup.dll
- Also in
TXTextControl.asTextControl. ASP. SDK TXTextControl.dll
Description
An instance of the Line class represents a single line in a Text Control document.
Syntax
public class LinePublic Class LineExamples
The following example shows how to read the document line by line.
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);
}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)
NextThe following example examines the first line in a short document.
textControl.Text = "Quarterly results\nRevenue increased by 12%.";
Line line = textControl.Lines[1];textControl.Text = "Quarterly results" & vbCrLf & "Revenue increased by 12%."
Dim line As Line = textControl.Lines(1)Members
Properties
| Property | Description |
|---|---|
| Baseline | 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. |
| Length | Gets the number of characters in the line including the break character. |
| Number | Gets the line's number. The first line has the number 1. |
| Page | Gets the number of the page to which the line belongs. The first page has the number 1. |
| Start | Gets the number (one-based) of the first character in the line. |
| Text | Gets the line's text. |
| TextBounds | 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. |
Methods
| Method | Description |
|---|---|
| Save | Saves the line's text with the specified format. |