TX Text Control .NET Server

LineCollection Class

Class|Introduced in 10.1
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXTextControl.Core.dll
Install
dotnet add package TXTextControl.TextControl.Core.SDK .NET 8 and later. For .NET Framework, reference TXTextControl.dll from the setup.
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.dll
Implements
ICollection, IEnumerable

Description

An instance of the LineCollection class contains all text lines in a Text Control document or part of the document represented through objects of the type Line. An instance of this class can be obtained with the TextControl.Lines, HeaderFooter.Lines or TextFrame.Lines property. The LineCollection class implements the IEnumerable and the ICollection interfaces.

Syntax

public class LineCollection : ICollection, IEnumerable

Examples

The following example shows how to loop through all lines and how to get the according page number of that line.

foreach (TXTextControl.Line line in textControl1.Lines)
{
    Console.WriteLine("Line " + line.Number.ToString() +
                     " is on page " + line.Page.ToString());
}

The following example works with lines in the current document.

LineCollection lineCollection = textControl.Lines;
textControl.Text = "Quarterly results\nRevenue increased by 12%.";

Members

Properties

PropertyDescription
CountGets the number of elements contained in the collection.
ItemGets the line from the collection. In C# this property is the indexer for the LineCollection class.

Methods

MethodDescription
CopyToCopies the elements of the collection to an array, starting at a particular index.
GetEnumeratorReturns an enumerator that can be used to iterate through the collection.
GetItemGets a particular line from the collection.