TX Text Control .NET Server

ServerTextControl Class

Class|Introduced in 12.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXTextControl.Server.Core.dll
Install
dotnet add package TXTextControl.TextControl.Core.SDK .NET 8 and later. For .NET Framework, reference TXTextControl.Server.dll from the setup.
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.Server.dll
Inherits
  1. Component
  2. ServerTextControl
Derived
TextViewGenerator
Implements
IFormattedText

Description

The ServerTextControl class implements a component that provide high-level text processing features for server-based applications. It is inherited from the System.ComponentModel.Component class. The following describes only the properties, methods and events defined through the ServerTextControl class. For a list of properties, methods and events inherited from the System.ComponentModel.Component class see the .NET Framework reference. The ServerTextControl class implements the IFormattedText interface.

Syntax

public class ServerTextControl : Component, IFormattedText

Examples

The following example creates a short report and formats its heading with the initialized text control.

textControl.Text = "Quarterly results\nRevenue increased by 12%.";
textControl.Select(0, "Quarterly results".Length);
textControl.Selection.Bold = true;

Members

Constructors

ConstructorDescription
ServerTextControlInitializes a new instance of the ServerTextControl class. After initialization the Create method must be called to enable further resources.

Properties

PropertyDescription
ApplicationFieldsGets a collection of all Microsoft Word or Heiler HighEdit fields that have been created or imported from a Microsoft Word or RTF document. The property value is an object of the type ApplicationFieldCollection. Before loading a document the LoadSettings.ApplicationFieldFormat property must be set, otherwise this collection is empty. The collection contains the fields contained in the main text of the document.
BackColorGets or sets the background color of the control. The property value can be set to Color.Transparent to have a transparent background. A transparent background is only possible if the ViewMode property has been set to SimpleControl.
BarcodesGets a collection of all barcodes in a document. The property value is an object of the type DataVisualization.BarcodeCollection. The collection can be used to get or to alter a barcode's attributes and to add barcodes to or to remove barcodes from a document.
BaselineGets or sets the baseline alignment, in twips, of the control. Positive values moves the baseline to superscript, negative values moves the baseline to subscript.
ChartsGets a collection of all charts in a 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 from a document.
CommentsGets a collection of all comments. The property's value is an object of the type CommentCollection.
DefaultFormattingPrinterNot described in the reference. public static string DefaultFormattingPrinter { get; set; }
DocumentLinksGets a collection of all links that point to targets in the same document. The property value is an object of the type DocumentLinkCollection.
DocumentSettingsGets a DocumentSettings object providing properties which inform about general document settings, such as author and title, contained in the document the user is currently working on. When a document is loaded this object is filled with such information and all values are automatically stored when the document is saved.
DocumentTargetsGets a collection of all targets in the document. The property value is an object of the type DocumentTargetCollection.
DrawingsGets a collection of all drawings in a document. The property value is an object of the type DataVisualization.DrawingCollection. The collection can be used to get or to alter a drawing's attributes and to add drawings to or to remove drawings from a document.
EditableRegionsGets a collection of all editable regions contained in the document. The property's value is an object of the type EditableRegionCollection.
EntryAssemblySets main project assembly which licenses a ServerTextControl. By default, this is the application's executable assembly.
FontGets or sets the control's font.
FontSettingsGets a FontSettings object which provides properties determining which fonts can be used in a document.
FontUnderlineStyleGets or sets underlining style for the text displayed by the control. This property only determines the style. The ServerTextControl.Font property determines whether text is underlined or not.
FootnotesGets a collection of all footnotes contained in the main text of the document. The property value is an object of the type FootnoteCollection.
ForeColorGets or sets the foreground color of the control.
FormattingPrinterGets or sets the name of a printer the text dimensions and capabilities of which are used to format the document. If the document is printed with this printer the displayed and the printed document have the same dimensions. If the property is set to Standard, the system installed standard printer is used to format the document. If the property is set to Display, the font dimensions of the display device are used to format the document. If the specified printer is not installed, the standard printer is used.
FormFieldsGets a collection of all form fields contained in the document. The property's value is an object of the type FormFieldCollection.
FormulaReferenceStyleGets or sets a value determining how references to table cells in formulas are specified. Supported are the A1 and the R1C1 notation. The A1 notation specifies a table cell with a column letter and a row number, for example B3 refers to the table cell in the third row and the second column. The R1C1 notation addresses a table cell with a row number and a column number, for example R3C2 refers to the table cell in the third row and the second column. Relative addresses can be expressed with square brackets. R[-3]C[-2]. The numbers inside the square brackets show how many rows or columns the cell is relative to itself. Negative row numbers mean that the referenced cell is above the cell containing the formula. Negative column numbers mean that the referenced cell is to the left of the cell containing the formula.
FramesGets a collection of all images, textframes, charts and barcodes in a document. The property value is an object of the type FrameCollection. The collection can be used to get or to alter common attributes.
HeadersAndFootersGets a collection of all headers and footers the current document contains. The property's value is an object of the type HeaderFooterCollection.
HypertextLinksGets a collection of all hypertext links contained in the main text of the document. The property's value is an object of the type HypertextLinkCollection.
ImagesGets a collection of all images contained in the main text of the document. The property's value is an object of the type ImageCollection.
InlineStylesGets a collection of all inline styles the current document contains. The property's value is an object of the type InlineStyleCollection.
InputPositionGets or sets the current text input position. The property's value is an object of the type InputPosition.
IsCreatedGets a value indicating whether the control is completely created.
IsFormulaCalculationEnabledGets or sets a value indicating whether formulas in tables are automatically calculated when the text of an input cell is changed.
IsHyphenationEnabledGets or sets a value indicating whether hyphenation is active or not. If hyphenation is enabled, a word at the end of a line is automatically divided with a connected spell checking component. A spell checking component can be connected with the SpellChecker property. Additionally, the ServerTextControl.HyphenateWord event is raised with the calculated divide position. This position can be changed through a connected event handler.
IsLanguageDetectionEnabledGets or sets a value indicating whether language detection is active or not. If language detection is enabled, a language is automatically set for all pieces of text with a neutral language. To use this feature, at least the TXSpell 5.0 spell checking component must be connected with the ServerTextControl through the SpellChecker property.
IsSpellCheckingEnabledGets or sets a value indicating whether spell checking is active or not. If spell checking is enabled either the text is automatically checked with a connected spell checking component or the ServerTextControl.SpellCheckText event is raised when the text of a document changes. The event handler can then be used to check the text on misspelled words. A spell checking component can be connected with the SpellChecker property.
LandscapeGets or sets a value indicating whether the page orientation is landscape or portrait.
LinesGets a collection of all lines contained in the main text of the document. The property value is an object of the type LineCollection.
ListFormatGets or sets the type and the formatting attributes of a bulleted or numbered list. The property value is an object of the type ListFormat. For more information see the description of the ListFormat class.
MisspelledWordsGets a collection of all misspelled words in the main text of the document. Lists of misspelled words of a header or footer or of a text frame are provided through the HeaderFooter.MisspelledWords and TextFrame.MisspelledWords properties. The property value is an object of the type MisspelledWordCollection.
PageMarginsGets or sets the margins for the pages of the current document. The measure depends on the ServerTextControl.PageUnit property. The default measure is 1/100th inch. The property value is an object of the type PageMargins. For more information see the description of the PageMargins class.
PagesGets the number of pages contained in the current document.
PageSizeSpecifies the width and height of the pages for the current document. The measure depends on the ServerTextControl.PageUnit property. The default measure is 1/100th inch. The property value is an object of the type PageSize. For more information see the description of the PageSize class.
PageUnitGets or sets the measure used for page sizes and page margins.
ParagraphFormatGets or sets the paragraph formatting attributes of the text displayed by the control. The property value is an object of the type ParagraphFormat. For more information see the description of the ParagraphFormat class.
ParagraphsGets a collection of all paragraphs contained in the main text of the document. The property value is an object of the type ParagraphCollection.
ParagraphStylesGets a collection of all paragraph styles the current document contains. The property's value is an object of the type ParagraphStyleCollection.
SectionsGets a collection of all sections in the document. The property's value is an object of the type SectionCollection.
SelectionGets or sets the current selection in the main text of the document. The property value is an object of the type Selection. A selection can be used to assign character and paragraph formatting attributes to a piece of text.
SignatureFieldsGets a collection of all signature fields contained in the main text of the document. The property value is an object of the type SignatureFieldCollection.
SpellCheckerSpecifies the spell checking component to be used with a ServerTextControl. The property value is null if there is no spell checking component connected. Otherwise it must be an object of the type TXSpell. When a spell checking component is connected and the IsSpellCheckingEnabled property has been set to true, the MisspelledWords collection is automatically filled with all misspelled words contained in the current document. When a spell checking component is connected and the IsHyphenationEnabled property has been set to true, a document is automatically hyphenated. If the IsLanguageDetectionEnabled property has been set to true, a language is automatically detected for all text parts with a neutral language.
SubTextPartsGets a collection of all subtextparts contained in the document. The property's value is an object of the type SubTextPartCollection.
TablesGets a collection of all tables contained in the document. The property's value is an object of the type TableCollection.
TablesOfContentsGets a collection of all tables of contents in the document. The property's value is an object of the type TableOfContentsCollection.
TextGets or sets the control's text.
TextBackColorGets or sets the background color for the text.
TextCharsGets a collection of all characters contained in the main text of the document. The property value is an object of the type TextCharCollection.
TextFieldsGets a collection of all standard text fields contained in the main text of the document. The property's value is an object of the type TextFieldCollection.
TextFramesGets a collection of all text frames the current document contains. The property's value is an object of the type TextFrameCollection. If a text frame contains further text frames, the inner frames are not contained in this collection.
TextPartsGets a collection of all text parts the current document contains. The property's value is an object of the type TextPartCollection. A text part can be the main text, a text frame or a header or footer.
TrackedChangesGets a collection of all changes made in the active part of the document. The property's value is an object of the type TrackedChangeCollection.

Methods

MethodDescription
AppendLoads text in a certain format from a file, a byte array or a string and appends it to the existing document.
ClearClears the selected text or the character right from the current input position.
CreateInitializes the resources of a newly instantiated object. This method must be called before using the object.
FindFinds a text string in the main text of the document.
GetPagesGets a collection of all pages in the document. The property's value is an object of the type PageCollection.
GetSupportedFontsGets an array of strings specifying the names of all currently supported fonts. These fonts depend on the formatting device set with the ServerTextControl.FormattingPrinter property. The method returns null if the ServerTextControl has not been completely initialized.
GetSupportedPaperSizesGets an array of PaperSize structures specifying the names and the size of all currently supported paper sizes. These paper sizes depend on the formatting device set with the ServerTextControl.FormattingPrinter property. The method returns null, if the ServerTextControl has not been completely initialized.
GetTextFieldsReturns a collection containing text fields of the specified types.
GetVersionInfoReturns an object of the type VersionInfo, which provides information about the installed TX Text Control version.
GetXmlElementsReturns a collection of XML elements. It is an object of the type XmlElementCollection.
InstallFontsNot described in the reference. public static bool InstallFonts(string fontLocation);
LoadLoads text in a certain format. The complete contents of a Text Control are replaced.
OnAdaptFontRaises the AdaptFont event.
OnBarcodeCreatedRaises the BarcodeCreated event.
OnBarcodeDeletedRaises the BarcodeDeleted event.
OnCommentCreatedRaises the CommentCreated event.
OnCommentDeletedRaises the CommentDeleted event.
OnContentsResetRaises the ContentsReset event.
OnDocumentLoadedRaises the DocumentLoaded event.
OnDocumentTargetCreatedRaises the DocumentTargetCreated event.
OnDocumentTargetDeletedRaises the DocumentTargetDeleted event.
OnDrawingCreatedRaises the DrawingCreated event.
OnDrawingDeletedRaises the DrawingDeleted event.
OnEditableRegionCreatedRaises the EditableRegionCreated event.
OnEditableRegionDeletedRaises the EditableRegionDeleted event.
OnFootnoteCreatedRaises the FootnoteCreated event.
OnFootnoteDeletedRaises the FootnoteDeleted event.
OnHyphenateWordRaises the HyphenateWord event.
OnImageCreatedRaises the ImageCreated event.
OnImageDeletedRaises the ImageDeleted event.
OnSignatureFieldCreatedRaises the SignatureFieldCreated event.
OnSignatureFieldDeletedRaises the SignatureFieldDeleted event.
OnSpellCheckTextRaises the SpellCheckText event.
OnSubTextPartCreatedRaises the SubTextPartCreated event.
OnSubTextPartDeletedRaises the SubTextPartDeleted event.
OnTableCreatedRaises the TableCreated event.
OnTableDeletedRaises the TableDeleted event.
OnTableOfContentsCreatedRaises the TableOfContentsCreated event.
OnTableOfContentsDeletedRaises the TableOfContentsDeleted event.
OnTextFieldCreatedRaises the TextFieldCreated event.
OnTextFieldDeletedRaises the TextFieldDeleted event.
OnTextFrameCreatedRaises the TextFrameCreated event.
OnTextFrameDeletedRaises the TextFrameDeleted event.
OnTrackedChangeCreatedRaises the TrackedChangeCreated event.
OnTrackedChangeDeletedRaises the TrackedChangeDeleted event.
OnXmlInvalidRaises the XmlInvalid event.
OnXmlNotWellFormedRaises the XmlNotWellFormed event.
PrintPrints a Text Control document or a part of a document.
ResetBackColorResets the BackColor property to its default value. The default value is the system color for the window background.
ResetContentsDeletes the entire contents of the control.
ResetFontResets the Font property to its default value. The default value is 10 pt Arial.
ResetFontSettingsNot described in the reference. public void ResetFontSettings();
ResetForeColorResets the ForeColor property to its default value. The default value is the system color for the window text.
ResetListFormatNot described in the reference. public void ResetListFormat();
ResetPageMarginsResets the PageMargins property to its default value. The default page margins are 1 inch.
ResetPageSizeResets the PageSize property to its default value. The default page size is US letter (8,5 x 11 inch).
ResetParagraphFormatNot described in the reference. public void ResetParagraphFormat();
ResetTextBackColorResets the TextBackColor property to its default value. The default value is the setting of the BackColor property.
SaveSaves the complete contents of a document with the specified format.
SelectSelects text within the control.
SelectAllSelects all text in the control.
SelectWordSelects the word at the current text input position.

Events

EventDescription
AdaptFontOccurs for each font that must be adapted, because it is not supported. The event can occur if another printer is set with the ServerTextControl.FormattingPrinter property, if a document is loaded that contains a font which is not supported or if fonts have been restricted with the FontSettings.EmbeddableFontsOnly or the FontSettings.TrueTypeFontsOnly property. The event occurs only, if the FontSettings.AdaptFontEvent property has been set to true. The event handler receives an argument of type AdaptFontEventArgs containing data related to this event.
BarcodeCreatedOccurs when a new barcode has been created. It occurs, when a file containing barcodes has been loaded. It does not occur, when a barcode has been added with the BarcodeCollection.Add method. The event handler receives an argument of type BarcodeEventArgs containing data related to this event.
BarcodeDeletedOccurs when a barcode has been deleted. It occurs, when a barcode has been deleted with the BarcodeCollection.Remove method. The event handler receives an argument of type BarcodeEventArgs containing data related to this event.
ChartCreatedOccurs when a new chart has been created. It occurs, when a file containing charts has been loaded. It does not occur, when a chart has been added with the ChartCollection.Add method. The event handler receives an argument of type ChartEventArgs containing data related to this event.
ChartDeletedOccurs when a chart has been deleted. It occurs, when a chart has been deleted with the ChartCollection.Remove method. The event handler receives an argument of type ChartEventArgs containing data related to this event.
CommentCreatedOccurs when a piece of text has been commented. The event handler receives an argument of type CommentEventArgs containing data related to this event.
CommentDeletedOccurs when a comment has been removed from the document. The event handler receives an argument of type CommentEventArgs containing data related to this event.
ContentsResetOccurs when all text contents have been deleted and all attributes have been reset to the state after initialization. The event handler receives an argument of type EventArgs containing data related to this event.
DocumentLoadedOccurs when a new document has been loaded. The event handler receives an argument of type EventArgs containing data related to this event.
DocumentTargetCreatedOccurs when a document target has been created. The event handler receives an argument of type DocumentTargetEventArgs containing data related to this event.
DocumentTargetDeletedOccurs when a document target has been deleted. The event handler receives an argument of type DocumentTargetEventArgs containing data related to this event.
DrawingCreatedOccurs when a new drawing has been created. It occurs, when a drawing has been inserted in the document via the clipboard and when a file containing drawings has been loaded. It does not occur, when a drawing has been added with the DrawingCollection.Add method. The event handler receives an argument of type DrawingEventArgs containing data related to this event.
DrawingDeletedOccurs when a drawing has been deleted. It occurs, when a drawing has been deleted while editing a document and when a drawing has been deleted with the DrawingCollection.Remove method. The event handler receives an argument of type DrawingEventArgs containing data related to this event.
EditableRegionCreatedOccurs when an editable region has been created. The event handler receives an argument of type EditableRegionEventArgs containing data related to this event.
EditableRegionDeletedOccurs when an editable region has been deleted. The event handler receives an argument of type EditableRegionEventArgs containing data related to this event.
FootnoteCreatedOccurs when a footnote has been created. The event handler receives an argument of type FootnoteEventArgs containing data related to this event.
FootnoteDeletedOccurs when a footnote has been deleted. The event handler receives an argument of type FootnoteEventArgs containing data related to this event.
HyphenateWordOccurs, if a word does not fit on the line and must be hyphenated. This event occurs only, if the IsHyphenationEnabled property has been set to true. The event handler receives an argument of type HyphenateWordEventArgs containing data related to this event.
ImageCreatedOccurs when a new image has been created. It occurs if a file containing images has been loaded. It does not occur if an image has been added with the ImageCollection.Add method. The event handler receives an argument of type ImageEventArgs containing data related to this event.
ImageDeletedOccurs when an image has been deleted. It occurs if an image has been deleted while removing parts of a document or if an image has been deleted with the ImageCollection.Remove method. The event handler receives an argument of type ImageEventArgs containing data related to this event.
SignatureFieldCreatedOccurs when a new signature field has been created. It occurs if a signature field has been inserted in the document with the clipboard or if a file containing signature fields has been loaded. It does not occur if a signature field has been added with the SignatureFieldCollection.Add method. The event handler receives an argument of type SignatureFieldEventArgs containing data related to this event.
SignatureFieldDeletedOccurs when a signature field has been deleted. It occurs if a signature field has been deleted while editing a document or if a signature field has been deleted with the SignatureFieldCollection.Remove method. The event handler receives an argument of type SignatureFieldEventArgs containing data related to this event.
SpellCheckTextOccurs, if the document's text has been altered and the spelling of the new text must be checked. This event occurs only, if the SpellChecker property has been set to null and if the IsSpellCheckingEnabled property has been set to true. If a spell checking component has been connected with the ServerTextControl, this event is handled internally. The event handler receives an argument of type SpellCheckTextEventArgs containing data related to this event.
SubTextPartCreatedOccurs when a subtextpart has been created. The event handler receives an argument of type SubTextPartEventArgs containing data related to this event.
SubTextPartDeletedOccurs when a subtextpart has been deleted. The event handler receives an argument of type SubTextPartEventArgs containing data related to this event.
TableCreatedOccurs after a new table has been created when loading a document which contains a table without an identifier. It does not occur when the table is inserted with the TableInsert method or for tables that have a previously set identifier when loading a document. The event handler receives an argument of type TableEventArgs containing data related to this event.
TableDeletedOccurs after a table has been deleted. The event handler receives an argument of type TableEventArgs containing data related to this event.
TableOfContentsCreatedOccurs when a table of contents has been created. The event handler receives an argument of type TableOfContentsEventArgs containing data related to this event.
TableOfContentsDeletedOccurs when a table of contents has been deleted. The event handler receives an argument of type TableOfContentsEventArgs containing data related to this event.
TextFieldCreatedOccurs when a text field has been created. The event handler receives an argument of type TextFieldEventArgs containing data related to this event.
TextFieldDeletedOccurs when a text field has been deleted. The event handler receives an argument of type TextFieldEventArgs containing data related to this event.
TextFrameCreatedOccurs when a new text frame has been created. It occurs for each text frame if a file containing text frames has been loaded. It does not occur if an text frame has been added with the TextFrameCollection.Add method. The event handler receives an argument of type TextFrameEventArgs containing data related to this event.
TextFrameDeletedOccurs when a text frame has been deleted. It occurs if a text frame has been deleted while changing a document or if an text frame has been deleted with the TextFrameCollection.Remove method. The event handler receives an argument of type TextFrameEventArgs containing data related to this event.
TrackedChangeCreatedOccurs when a tracked change has been created. A tracked change is created when a document is loaded containing tracked changes. The event handler receives an argument of type TrackedChangeEventArgs containing data related to this event.
TrackedChangeDeletedOccurs when a tracked change has been deleted. A tracked change is deleted when the change is either accepted or rejected. The event handler receives an argument of type TrackedChangeEventArgs containing data related to this event.
XmlInvalidOccurs when a loaded or changed XML document cannot be validated with the document type definition (DTD) referenced in the document. The event handler receives an argument of type XmlErrorEventArgs containing data related to this event.
XmlNotWellFormedOccurs when a loaded XML document is not well-formed. The event handler receives an argument of type XmlErrorEventArgs containing data related to this event.