TX Text Control .NET Server

SectionCollection Class

Class|Introduced in 14.0
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 SectionCollection class contains all sections of a document. A document has at least one section. An instance of this class can be obtained with the TextControl.Sections property. The SectionCollection class implements the IEnumerable and the ICollection interfaces.

Syntax

public sealed class SectionCollection : ICollection, IEnumerable

Examples

The following example shows how to add a new section and get the actual section number:

textControl1.Sections.Add(TXTextControl.SectionBreakKind.BeginAtNewPage);
Console.WriteLine("Section " + textControl1.Sections.GetItem().Number.ToString()
  + " of " + textControl1.Sections.Count.ToString());

The following example works with sections in the current document.

SectionCollection sectionCollection = textControl.Sections;
sectionCollection.Add(SectionBreakKind.BeginAtNewPage, -1);

Members

Properties

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

Methods

MethodDescription
AddAdds a new section to a document.
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 the Section with the current text input position from the collection.

Further Reading