TX Text Control .NET for WPF

MainText Class

Class|Introduced in 16.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WPF.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXTextControl.dll
Install
dotnet add package TXTextControl.TextControl.WPF.SDK .NET 8 and later. For .NET Framework, reference TXTextControl.dll from the setup.
Inherits
  1. TextPartBase
  2. MainText
Implements
IFormattedText

Description

The MainText class represents the main text of a TX Text Control document. A TX Text Control document consists of the main text, and additionally other pieces of text such as text frames and headers or footers. The MainText class implements the IFormattedText interface. Differently from the TextControl or WPF.TextControl classes the MainText object's collections of the IFormattedText interface do not depend on the input focus. For example, the TextControl.Tables collection contains the tables of the main text, if the main text has the input focus, but it contains the tables of the text frame, if a text frame has the input focus. The MainText.Tables collection always contains the tables of the main text regardless of the input focus.

Syntax

public class MainText : TextPartBase, IFormattedText

Examples

The following example applies bold formatting through the main text's selection.

Selection formattedSelection = mainText.Selection;
formattedSelection.Bold = true;
mainText.Selection = formattedSelection;

Members

Properties

PropertyDescription
ChartsGets a collection of all charts contained in the main text of the document. The property value is an object of the type DataVisualization.ChartCollection. The collection can be used to get or to alter a chart's attributes and to add charts to or to remove charts.
TextFramesGets a collection of all text frames contained in the main text of the document. The property value is an object of the type TextFrameCollection.