ServerTextControl Class
- Namespace
TXTextControl
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. Core. SDK
- Assembly
TXTextControl.Server. Core. dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. Core. SDK TXTextControl.from the setup.Server. dll
- Also in
TXTextControl.asTextControl. ASP. SDK TXTextControl.Server. dll
- Inherits
- Component
- Server
Text Control
- Derived
- Text
View Generator
- Implements
- IFormatted
Text
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, IFormattedTextPublic Class ServerTextControl
Inherits Component
Implements IFormattedTextExamples
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;textControl.Text = "Quarterly results" & vbCrLf & "Revenue increased by 12%."
textControl.Select(0, "Quarterly results".Length)
textControl.Selection.Bold = TrueMembers
Constructors
| Constructor | Description |
|---|---|
| ServerTextControl | Initializes a new instance of the ServerTextControl class. After initialization the Create method must be called to enable further resources. |
Properties
| Property | Description |
|---|---|
| ApplicationFields | Gets 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. |
| BackColor | Gets 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. |
| Barcodes | Gets 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. |
| Baseline | Gets or sets the baseline alignment, in twips, of the control. Positive values moves the baseline to superscript, negative values moves the baseline to subscript. |
| Charts | Gets 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. |
| Comments | Gets a collection of all comments. The property's value is an object of the type CommentCollection. |
| DefaultFormattingPrinter | Not described in the reference. public static string DefaultFormattingPrinter { get; set; } |
| DocumentLinks | Gets a collection of all links that point to targets in the same document. The property value is an object of the type DocumentLinkCollection. |
| DocumentSettings | Gets 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. |
| DocumentTargets | Gets a collection of all targets in the document. The property value is an object of the type DocumentTargetCollection. |
| Drawings | Gets 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. |
| EditableRegions | Gets a collection of all editable regions contained in the document. The property's value is an object of the type EditableRegionCollection. |
| EntryAssembly | Sets main project assembly which licenses a ServerTextControl. By default, this is the application's executable assembly. |
| Font | Gets or sets the control's font. |
| FontSettings | Gets a FontSettings object which provides properties determining which fonts can be used in a document. |
| FontUnderlineStyle | Gets 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. |
| Footnotes | Gets a collection of all footnotes contained in the main text of the document. The property value is an object of the type FootnoteCollection. |
| ForeColor | Gets or sets the foreground color of the control. |
| FormattingPrinter | Gets 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. |
| FormFields | Gets a collection of all form fields contained in the document. The property's value is an object of the type FormFieldCollection. |
| FormulaReferenceStyle | Gets 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. |
| Frames | Gets 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. |
| HeadersAndFooters | Gets a collection of all headers and footers the current document contains. The property's value is an object of the type HeaderFooterCollection. |
| HypertextLinks | Gets 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. |
| Images | Gets a collection of all images contained in the main text of the document. The property's value is an object of the type ImageCollection. |
| InlineStyles | Gets a collection of all inline styles the current document contains. The property's value is an object of the type InlineStyleCollection. |
| InputPosition | Gets or sets the current text input position. The property's value is an object of the type InputPosition. |
| IsCreated | Gets a value indicating whether the control is completely created. |
| IsFormulaCalculationEnabled | Gets or sets a value indicating whether formulas in tables are automatically calculated when the text of an input cell is changed. |
| IsHyphenationEnabled | Gets 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. |
| IsLanguageDetectionEnabled | Gets 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. |
| IsSpellCheckingEnabled | Gets 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. |
| Landscape | Gets or sets a value indicating whether the page orientation is landscape or portrait. |
| Lines | Gets a collection of all lines contained in the main text of the document. The property value is an object of the type LineCollection. |
| ListFormat | Gets 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. |
| MisspelledWords | Gets 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. |
| PageMargins | Gets 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. |
| Pages | Gets the number of pages contained in the current document. |
| PageSize | Specifies 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. |
| PageUnit | Gets or sets the measure used for page sizes and page margins. |
| ParagraphFormat | Gets 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. |
| Paragraphs | Gets a collection of all paragraphs contained in the main text of the document. The property value is an object of the type ParagraphCollection. |
| ParagraphStyles | Gets a collection of all paragraph styles the current document contains. The property's value is an object of the type ParagraphStyleCollection. |
| Sections | Gets a collection of all sections in the document. The property's value is an object of the type SectionCollection. |
| Selection | Gets 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. |
| SignatureFields | Gets a collection of all signature fields contained in the main text of the document. The property value is an object of the type SignatureFieldCollection. |
| SpellChecker | Specifies 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. |
| SubTextParts | Gets a collection of all subtextparts contained in the document. The property's value is an object of the type SubTextPartCollection. |
| Tables | Gets a collection of all tables contained in the document. The property's value is an object of the type TableCollection. |
| TablesOfContents | Gets a collection of all tables of contents in the document. The property's value is an object of the type TableOfContentsCollection. |
| Text | Gets or sets the control's text. |
| TextBackColor | Gets or sets the background color for the text. |
| TextChars | Gets a collection of all characters contained in the main text of the document. The property value is an object of the type TextCharCollection. |
| TextFields | Gets 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. |
| TextFrames | Gets 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. |
| TextParts | Gets 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. |
| TrackedChanges | Gets 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
| Method | Description |
|---|---|
| Append | Loads text in a certain format from a file, a byte array or a string and appends it to the existing document. |
| Clear | Clears the selected text or the character right from the current input position. |
| Create | Initializes the resources of a newly instantiated object. This method must be called before using the object. |
| Find | Finds a text string in the main text of the document. |
| GetPages | Gets a collection of all pages in the document. The property's value is an object of the type PageCollection. |
| GetSupportedFonts | Gets 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. |
| GetSupportedPaperSizes | Gets 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. |
| GetTextFields | Returns a collection containing text fields of the specified types. |
| GetVersionInfo | Returns an object of the type VersionInfo, which provides information about the installed TX Text Control version. |
| GetXmlElements | Returns a collection of XML elements. It is an object of the type XmlElementCollection. |
| InstallFonts | Not described in the reference. public static bool InstallFonts(string fontLocation); |
| Load | Loads text in a certain format. The complete contents of a Text Control are replaced. |
| OnAdaptFont | Raises the AdaptFont event. |
| OnBarcodeCreated | Raises the BarcodeCreated event. |
| OnBarcodeDeleted | Raises the BarcodeDeleted event. |
| OnCommentCreated | Raises the CommentCreated event. |
| OnCommentDeleted | Raises the CommentDeleted event. |
| OnContentsReset | Raises the ContentsReset event. |
| OnDocumentLoaded | Raises the DocumentLoaded event. |
| OnDocumentTargetCreated | Raises the DocumentTargetCreated event. |
| OnDocumentTargetDeleted | Raises the DocumentTargetDeleted event. |
| OnDrawingCreated | Raises the DrawingCreated event. |
| OnDrawingDeleted | Raises the DrawingDeleted event. |
| OnEditableRegionCreated | Raises the EditableRegionCreated event. |
| OnEditableRegionDeleted | Raises the EditableRegionDeleted event. |
| OnFootnoteCreated | Raises the FootnoteCreated event. |
| OnFootnoteDeleted | Raises the FootnoteDeleted event. |
| OnHyphenateWord | Raises the HyphenateWord event. |
| OnImageCreated | Raises the ImageCreated event. |
| OnImageDeleted | Raises the ImageDeleted event. |
| OnSignatureFieldCreated | Raises the SignatureFieldCreated event. |
| OnSignatureFieldDeleted | Raises the SignatureFieldDeleted event. |
| OnSpellCheckText | Raises the SpellCheckText event. |
| OnSubTextPartCreated | Raises the SubTextPartCreated event. |
| OnSubTextPartDeleted | Raises the SubTextPartDeleted event. |
| OnTableCreated | Raises the TableCreated event. |
| OnTableDeleted | Raises the TableDeleted event. |
| OnTableOfContentsCreated | Raises the TableOfContentsCreated event. |
| OnTableOfContentsDeleted | Raises the TableOfContentsDeleted event. |
| OnTextFieldCreated | Raises the TextFieldCreated event. |
| OnTextFieldDeleted | Raises the TextFieldDeleted event. |
| OnTextFrameCreated | Raises the TextFrameCreated event. |
| OnTextFrameDeleted | Raises the TextFrameDeleted event. |
| OnTrackedChangeCreated | Raises the TrackedChangeCreated event. |
| OnTrackedChangeDeleted | Raises the TrackedChangeDeleted event. |
| OnXmlInvalid | Raises the XmlInvalid event. |
| OnXmlNotWellFormed | Raises the XmlNotWellFormed event. |
| Prints a Text Control document or a part of a document. | |
| ResetBackColor | Resets the BackColor property to its default value. The default value is the system color for the window background. |
| ResetContents | Deletes the entire contents of the control. |
| ResetFont | Resets the Font property to its default value. The default value is 10 pt Arial. |
| ResetFontSettings | Not described in the reference. public void ResetFontSettings(); |
| ResetForeColor | Resets the ForeColor property to its default value. The default value is the system color for the window text. |
| ResetListFormat | Not described in the reference. public void ResetListFormat(); |
| ResetPageMargins | Resets the PageMargins property to its default value. The default page margins are 1 inch. |
| ResetPageSize | Resets the PageSize property to its default value. The default page size is US letter (8,5 x 11 inch). |
| ResetParagraphFormat | Not described in the reference. public void ResetParagraphFormat(); |
| ResetTextBackColor | Resets the TextBackColor property to its default value. The default value is the setting of the BackColor property. |
| Save | Saves the complete contents of a document with the specified format. |
| Select | Selects text within the control. |
| SelectAll | Selects all text in the control. |
| SelectWord | Selects the word at the current text input position. |
Events
| Event | Description |
|---|---|
| AdaptFont | Occurs 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. |
| BarcodeCreated | Occurs 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. |
| BarcodeDeleted | Occurs 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. |
| ChartCreated | Occurs 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. |
| ChartDeleted | Occurs 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. |
| CommentCreated | Occurs when a piece of text has been commented. The event handler receives an argument of type CommentEventArgs containing data related to this event. |
| CommentDeleted | Occurs when a comment has been removed from the document. The event handler receives an argument of type CommentEventArgs containing data related to this event. |
| ContentsReset | Occurs 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. |
| DocumentLoaded | Occurs when a new document has been loaded. The event handler receives an argument of type EventArgs containing data related to this event. |
| DocumentTargetCreated | Occurs when a document target has been created. The event handler receives an argument of type DocumentTargetEventArgs containing data related to this event. |
| DocumentTargetDeleted | Occurs when a document target has been deleted. The event handler receives an argument of type DocumentTargetEventArgs containing data related to this event. |
| DrawingCreated | Occurs 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. |
| DrawingDeleted | Occurs 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. |
| EditableRegionCreated | Occurs when an editable region has been created. The event handler receives an argument of type EditableRegionEventArgs containing data related to this event. |
| EditableRegionDeleted | Occurs when an editable region has been deleted. The event handler receives an argument of type EditableRegionEventArgs containing data related to this event. |
| FootnoteCreated | Occurs when a footnote has been created. The event handler receives an argument of type FootnoteEventArgs containing data related to this event. |
| FootnoteDeleted | Occurs when a footnote has been deleted. The event handler receives an argument of type FootnoteEventArgs containing data related to this event. |
| HyphenateWord | Occurs, 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. |
| ImageCreated | Occurs 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. |
| ImageDeleted | Occurs 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. |
| SignatureFieldCreated | Occurs 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. |
| SignatureFieldDeleted | Occurs 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. |
| SpellCheckText | Occurs, 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. |
| SubTextPartCreated | Occurs when a subtextpart has been created. The event handler receives an argument of type SubTextPartEventArgs containing data related to this event. |
| SubTextPartDeleted | Occurs when a subtextpart has been deleted. The event handler receives an argument of type SubTextPartEventArgs containing data related to this event. |
| TableCreated | Occurs 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. |
| TableDeleted | Occurs after a table has been deleted. The event handler receives an argument of type TableEventArgs containing data related to this event. |
| TableOfContentsCreated | Occurs when a table of contents has been created. The event handler receives an argument of type TableOfContentsEventArgs containing data related to this event. |
| TableOfContentsDeleted | Occurs when a table of contents has been deleted. The event handler receives an argument of type TableOfContentsEventArgs containing data related to this event. |
| TextFieldCreated | Occurs when a text field has been created. The event handler receives an argument of type TextFieldEventArgs containing data related to this event. |
| TextFieldDeleted | Occurs when a text field has been deleted. The event handler receives an argument of type TextFieldEventArgs containing data related to this event. |
| TextFrameCreated | Occurs 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. |
| TextFrameDeleted | Occurs 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. |
| TrackedChangeCreated | Occurs 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. |
| TrackedChangeDeleted | Occurs 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. |
| XmlInvalid | Occurs 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. |
| XmlNotWellFormed | Occurs when a loaded XML document is not well-formed. The event handler receives an argument of type XmlErrorEventArgs containing data related to this event. |