TX Text Control .NET for Windows Forms

SectionNumber Property

Property|Introduced in 14.0
Not found
No package of this release declares this member on this type or on a class it derives from.
Namespace
TXTextControl
Package
TXTextControl.TextControl.WinForms.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

Description

Returns the number of the section to which the header or footer belongs. The sections of the document are numbered beginning with 1. This property returns zero, if the header or footer object does not represent a single header or footer.

Syntax

No package of this release declares this member. The declaration below is the reference's, and code that uses it does not compile.

public int SectionNumber { get; }

Examples

The following example creates a header for the first section and configures its content or layout by using HeaderFooter.sectionnumber.

HeaderFooterCollection headers = textControl.Sections[1].HeadersAndFooters;
headers.Add(HeaderFooterType.Header);
HeaderFooter headerFooter = headers.GetItem(HeaderFooterType.Header);
headerFooter.Selection.Text = "Quarterly report";

int sectionNumber = headerFooter.Section;
if (sectionNumber > 0)
{
    Section section = textControl.Sections[sectionNumber];
    Console.WriteLine($"Page width: {section.Format.PageSize.Width}");
}

Limitations

Read only.