TX Text Control .NET for Windows Forms

Page Class

Class|Introduced in 14.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WinForms.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXTextControl.dll
Install
dotnet add package TXTextControl.TextControl.WinForms.SDK .NET 8 and later. For .NET Framework, reference TXTextControl.dll from the setup.

Description

An object of the Page class represents a formatted page of a document. Pages are numbered from the beginning to the end of the document beginning with 1. A document has at least one page. Each section of a document can have one or more pages depending on the text that is contained in the section. A section does not have to begin at the top of a page. Therefore more than one section can be on one page. A page object can be obtained from the page collection available through the TextControl.GetPages method. This collection is only available, if the TextControl.ViewMode property has been set to PageView.

Syntax

public class Page

Examples

The following example shows how to scroll to a specific page.

textControl1.ViewMode = TXTextControl.ViewMode.PageView;

for (int i = 0; i < 100; i++)
    textControl1.Selection.Text = new string('a', 200);

textControl1.ScrollLocation = new Point(textControl1.ScrollLocation.X,
                              textControl1.GetPages()[2].Bounds.Top);

The following example works with the first laid-out page of a short report.

textControl.Text = "Quarterly results\nRevenue increased by 12%.";
Page page = textControl.GetPages()[1];
page.Select();

Members

Properties

PropertyDescription
BoundsGets the bounding rectangle of the page, in twips, relative to the top of the document.
FooterGets the footer of the page. If there is no footer, null is returned.
HeaderGets the header of the page. If there is no header, null is returned.
LengthGets the number of characters of the page, including the page break character at the end of the page.
NumberGets the page's number. The first page has the number 1.
NumberInSectionGets the page number relative to the beginning of the section the page belongs to. The first page of the section has the number 1.
SectionGets the number, one-based, of the section the page belongs to. If there are more than one section on the page, the number of the first section is returned. The first section determines the page's size and orientation.
StartGets the number (one-based) of the page's first character.
TextBoundsGets the bounding rectangle of the page's text, in twips, relative to the top of the document.

Methods

MethodDescription
GetImageGets an image of the page's contents.
SelectSelects the text of the page. The page break characters bounding the page and the header and/or footer belonging to the page are not selected.

Further Reading

  • Inserting Background Images into TX Text Control –
  • Inserting and Printing Folding Marks Using TX Text Control –
  • TX Text Control .NET: Removing Empty Pages –
  • Sample Code: Getting the Page Content Rectangle –