TX Text Control .NET Server

TXTextControl Object

Object

Description

The TXTextControl JavaScript object provides a public API to manipulate the web editor via JavaScript functions in the browser.

Syntax

TXTextControl

Examples

The following example demonstrates TXTextControl in a practical document-editing workflow. The TXTextControl JavaScript object provides a public API to manipulate the web editor via JavaScript functions in the browser.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

TXTextControl.getText(
    function(result) {
        console.log("get text result:", result);
    },
    onTxError
);

Members

Properties

PropertyDescription
applicationFieldsGets a collection of all Microsoft Word fields that have been created or imported from a Microsoft Word or RTF document. (Inherited from FormattedText.)
barcodesGets a collection of all barcode frames contained in the text part with the input focus. This can be the main text, a text frame or a header or footer. The property value is an object of the type BarcodeCollection.
barcodeTypeSettingsThe type specific settings for the currently used barcode.
clipboardModeGets or sets the clipboard mode (client or server). The clipboard mode determines if the key combinations Ctrl+C, Ctrl+V and Ctrl+X copy to and from the client clipboard or if content is copied to and from the server clipboard. Possible values for this property are defined in the enumeration ClipboardMode.
commentsGets a collection of all comments in this text part. (Inherited from FormattedText.)
connectionIDReturns the unique connection ID of this session.
contextMenusEnabledGets or sets if a right click into the text area opens a context menu or not.
controlCharsObsolete. This property will be removed in one of the next versions. Gets or sets whether control characters are visible.
displayColorsThe displayed colors of the text control.
documentLinksGets a collection of all links which point to targets in the same document. (Inherited from FormattedText.)
documentPermissionsThe document permission settings.
documentSettingsThe DocumentSettings class provides properties which inform about general document settings, such as author and title, contained in the document the user is currently working on. When such a document is saved with one of the Save methods all settings are automatically stored.
documentTargetMarkersGets or sets whether document target markers are visible.
documentTargetsGets a collection of all document targets. (Inherited from FormattedText.)
editableRegionsGets a collection of all editable regions. (Inherited from FormattedText.)
editModeObsolete. This property will be removed in one of the next versions. Gets or sets the edit mode the control is in. Must be set with one of the EditMode values.
footnotesAll footnotes contained in the main text of the document.
formFieldsGets a collection of all form fields in the text part. (Inherited from FormattedText.)
framesGets a collection of all frames in the document. (Inherited from FormattedText.)
headersAndFootersGets a collection of all headers and footers in the document.
hypertextLinksGets a collection of all hypertext links. (Inherited from FormattedText.)
imagesGets a collection of all images contained in the text part with the input focus. This can be the main text, a text frame or a header or footer.
inlineStylesGets a collection of all inline styles the current document contains.
inputFormatAll formatting attributes at the current text input position.
inputPositionThe current text input position.
isHyphenationEnabledObsolete. This property will be removed in one of the next versions. Use the setter and getter methods instead. Gets or sets a value indicating whether hyphenation is active or not.
isLanguageDetectionEnabledObsolete. This property will be removed in one of the next versions. Use the setter and getter methods instead. Gets or sets a value indicating whether language detection is active or not.
isLoadingDialogEnabledGets or sets whether a wait dialog is shown while a document is being loaded.
isSpellCheckingEnabledObsolete. This property will be removed in one of the next versions. Use the setter and getter methods instead. Gets or sets a value indicating whether spell checking is active or not.
isTrackChangesEnabledObsolete. This property will be removed in one of the next versions. Use the setter and getter methods instead. Gets or sets a value indicating whether change tracking is active or not.
linesGets a collection of all text lines. (Inherited from FormattedText.)
listFormatThe type and the formatting attributes of a bulleted or numbered list.
misspelledWordsGets a collection of all misspelled words. (Inherited from FormattedText.)
pageMarginsThe margins for the pages of the current document. The measure depends on the page unit. The default measure is 1/100th inch.
pagesGets a collection of all pages in the document.
pageSizeThe width and height of the pages for the current document. The measure depends on the page unit. The default measure is 1/100th inch.
paragraphFormatThe paragraph formatting attributes of the text displayed by the control.
paragraphsGets a collection of all paragraphs. (Inherited from FormattedText.)
paragraphStylesAll paragraph formatting styles in the current document.
ribbonGets the control's ribbon bar object. Use this property to manipulate the ribbon bar.
ribbonPermissionsTabReturns the "Permissions" ribbon tab object.
rulerBarThe horizontal ruler bar.
saveDocumentQuestionDialogEnabledObsolete. This property will be removed in one of the next versions. Gets or sets if a confirmation dialog should be shown before discarding unsaved changes.
sectionsGets a collection of all sections in the document.
selectionReturns the current selection or sets the selection's position and length. The setter must be used as follows: TXTextControl.selection = { start: 2, length: 5 }
selectionGets the current selection. (Inherited from FormattedText.)
sideBarToggleButtonThe sidebar toggle button shown at the top right of the ribbon.
signatureFieldsGets a collection of all signature fields in the document.
statusBarThe status bar.
subTextPartsGets the current subtextparts. (Inherited from FormattedText.)
tableGridLinesGets or sets if table grid lines are visible.
tablesGets a collection of all tables. (Inherited from FormattedText.)
tablesOfContentsGets the current tables of contents. (Inherited from FormattedText.)
textCharsGets a collection of all text characters. (Inherited from FormattedText.)
textFieldsGets a collection of all standard text fields. (Inherited from FormattedText.)
textFieldsEditableGets or sets if text fields are editable or not.
textFrameMarkerLinesGets or sets if text frame marker lines are visible.
textFramesGets a collection of all text frames in the document.
textPartsGets a collection of all main text parts the current document contains. The main text parts are the main text, text frames and headers and footers.
textPartTypeGets the Text part type. Possible values are "mainText", "headerFooter" and "textFrame". (Inherited from FormattedText.)
trackedChangesGets a collection of all tracked changes. (Inherited from FormattedText.)
verticalRulerBarThe vertical ruler bar.
zoomFactorObsolete. This property will be removed in one of the next versions. Gets or sets the zoom factor, in percent, for a Text Control. Must be greater than or equal to 10 or one of the special zoom factor values defined in SpecialZoomFactor.

Methods

MethodDescription
addEventListenerThe addEventListener function registers event listener functions on the TXTextControl object.
addMergeFieldInserts a merge field at the current input position.
addTextFieldObsolete. This method will be removed in one of the next versions. Inserts a new ApplicationField or TextField at the current input position.
appendAppends text to the document in a certain format.
appendDocumentAppends text in a certain format to the current document.
atobUTF8Decodes a string of data which has been encoded using base-64 encoding.
beginUndoActionBegins a user-defined undo operation. All editing and fomatting changes made between beginUndoAction and endUndoAction belong to the undo operation. These changes are undone or redone in a single step. The specified user-defined name is available via getUndoActionName.
btoaUTF8Creates a base-64 encoded ASCII string from a unicode string. In contrast to the browser provided method btoa() this method handles all unicode characters and not only characters in the Latin1 range.
clearClears the selected text or the character right from the current input position.
clearUndoClears the undo buffer.
endUndoActionEnds a user-defined undo operation. All editing and fomatting changes made between beginUndoAction and endUndoAction belong to the undo operation. These changes are undone or redone in a single step.
findFinds a text string. The search starts at the specified position. (Inherited from FormattedText.)
flattenFormFieldsFlatten all form fields in the document. This means that all form fields are converted to static text.
focusSets the text input focus to the web editor.
getActivationStateGets a value indicating the current activation state. It can be activated, deactivated or disabled.
getAllowDragGets a value indicating whether the view generator can be a source of a Drag&Drop operation.
getAllowDropGets a value indicating whether the view generator can accept data that the user drags onto it.
getAllowUndoGets a value indicating whether the undo buffer is active or not.
getBackColorGets the Text Control's background color.
getBaselineGets the baseline alignment, in twips, of the Text Control.
getCanCharacterFormatInforms whether the currently selected text can be formatted with character formatting attributes. The value depends on whether the formatting is allowed and the currently set edit mode.
getCanCopyInforms whether a part of a Text Control document has been selected and can be copied to the clipboard. The value depends on whether the formatting is allowed and the currently set edit mode.
getCanDocumentFormatInforms whether the document can be formatted with page and section formatting attributes. The value depends on whether the formatting is allowed and the currently set edit mode.
getCanPasteInforms whether the document's text and/or formatting attributes can be changed. The value depends on DocumentPermissions.readOnly and the currently set edit mode.
getCanPrintInforms whether the document can be printed. The value depends on the DocumentPermissions.allowPrinting and the currently set edit mode.
getCanRedoInforms whether an operation can be re-done using the Redo method.
getCanStyleFormatInforms whether the document can be formatted with formatting styles. The value depends on the DocumentPermissions.allowFormattingStyles and the currently set edit mode.
getCanTableFormatInforms whether the currently selected text can be formatted with table formatting attributes.
getCanUndoGets a value indicating whether the user can undo the previous operation in a Text Control.
getCommentHighlightModeGets the global comment highlight mode.
getControlCharsGets whether the control characters are visible or not.
getCulturesReturns the culture and the UI culture of the control. The UI culture affects the string resource language. The culture represents date and time string formats, for example.
getDocumentTargetMarkersGets a value indicating that markers for hypertext targets are shown or not.
getDrawingMarkerLinesGets whether a marker frame is shown around a drawing to indicate its position and size.
getEditableRegionHighlightModeGets the global editable region highlight mode.
getEditModeGets a value indicating whether the document's text is protected, or can be freely edited and formatted.
getFileDirectoryObsolete. This method will be removed in one of the next versions. Requests the directory path where the files of a specific file type are stored on the web server.
getFontUnderlineStyleGets underlining style for the text displayed by the control. This property only determines the style.
getForeColorGets the foreground color of the control which is the color of the document's text.
getFormattingPrinterReturns the name of the currently selected formatting printer by calling a provided callback function. For more information on the formatting printer see function setFormattingPrinter.
getFormulaReferenceStyleGets 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.
getInsertionModeGets the insertion mode.
getInstalledPrintersGets the names of the printers installed on the server which are usable by Text Control.
getIsFormFieldValidationEnabledGets a value indicating whether form field validation is active or not.
getIsFormulaCalculationEnabledGets a value indicating whether formulas in tables are automatically calculated when the text of an input cell is changed.
getIsHyphenationEnabledGets a value indicating whether hyphenation is active or not.
getIsLanguageDetectionEnabledGets a value indicating whether language detection is active or not.
getIsSpellCheckingEnabledGets a value indicating whether spell checking is active or not.
getIsTrackChangesEnabledGets a value indicating whether track changes is active or not.
getLandscapeGets a value indicating whether the page orientation is landscape.
getPageCountGets the number of pages contained in the current document.
getPageUnitGets the measure used for page sizes and page margins.
getPermanentControlCharsGets a value indicating which control characters are shown permanently on the screen.
getRedoActionNameGets a string that represents the name of the action that will be performed when a call to the redo method is made.
getRenderModeGets the component render mode.
getSelectObjectsGets a value controlling the selection of objects which are inserted behind the text. When the property is set to true, a mouse click selects the object behind the text. Otherwise, when this property is set to false, text in front of the object can be selected.
getStatusBarColorReturns the background color of the status bar by calling a provided callback function.
getSubTextPartsObsolete. This method will be removed in one of the next versions. Requests a collection of either all subtextparts the current text part contains or only the subtextpart containing the input position from the server and returns the collection by calling a callback function which has to be provided as a parameter to the function.
getSupportedFontsGets an array of strings specifying the names of all currently supported fonts.
getSupportedPaperSizesGets an array of PaperSize structures specifying the names and the size of all currently supported paper sizes.
getTextGets the control's text.
getTextBackColorGets the background color for the text.
getTextFieldsObsolete. This method will be removed in one of the next versions. Requests a collection of either all text fields the current text part contains or only the text field containing the input position from the server and returns the collection by calling a callback function which has to be provided as a parameter to the function.
getTextFieldsByTypeReturns an array of static text field information objects. (Inherited from FormattedText.)
getTextFrameMarkerLinesGets whether text frames that have no border line are shown with marker lines.
getTextPartsObsolete. This method will be removed in one of the next versions. Requests a collection of either all text parts the current document contains or only the text part containing the input position from the server and returns the collection by calling a callback function which has to be provided as a parameter to the function.
getUndoActionNameGets a string that represents the name of the action that will be performed when a call to the undo method is made. The property's value is null if there is no action that can be undone.
getUserNamesGets a list of names specifying users who have access to editable regions. When a document is set to read-only all editable regions that are related to these users can be edited.
getViewModeGets the mode how Text Control displays a document.
initInitializes the document editor.
loadLoads text in a certain format. The complete contents of the web editor are replaced.
loadDocumentLoads text in a certain format. The complete contents of the web editor are replaced.
loadJsonDataLoads JSON data which is used to create table and field name menu items in the mailings ribbon tab.
loadSelectionObsolete. This method will be removed in one of the next versions. Loads text in a certain format into the current selection.
loadXMLDatabaseLoads an XML database which is used to create table and field name menu items in the mailings ribbon tab.
printDocumentAttempts to print the current document in the browser. Not all browsers support this.
redoRedoes the last Text Control operation.
refreshLayoutForces a layout refresh of the document editor. Use this method in cases where the editor doesn't automatically react to layout changes of your web site.
removeEventListenerThe removeListener function removes the specified event listener from the TXTextControl object.
removeFromDomCloses the WebSocket connection gracefully and removes the whole editor from the DOM.
removeTextFieldObsolete. This method will be removed in one of the next versions. The removeTextField method removes a text field from the document.
resetContentsDeletes the entire contents of the control.
saveSaves the current document in a certain format and sends the result back asynchronously by calling a given callback function.
saveDocumentSaves the current document in a certain format and sends the result back asynchronously by calling a given callback function.
saveSelectionObsolete. This method will be removed in one of the next versions. Saves the current selection in a certain format and sends the result back asynchronously by calling a given callback function.
selectSelects text within the control.
selectAllSelects all text in the control.
selectWordSelects the word at the current text input position.
setActivationStateSets a value indicating the current activation state. It can be activated, deactivated or disabled.
setAllowDragSets a value indicating whether the view generator can be a source of a Drag&Drop operation.
setAllowDropSets a value indicating whether the view generator can accept data that the user drags onto it.
setAllowUndoSets a value indicating whether the undo buffer is active or not.
setBackColorSets the Text Control's background color.
setBaselineSets the baseline alignment, in twips, of the Text Control.
setCommentHighlightModeSets the global comment highlight mode.
setControlCharsSets whether the control characters are visible or not.
setDocumentTargetMarkersSets a value indicating that markers for hypertext targets are shown or not.
setDrawingMarkerLinesSets whether a marker frame is shown around a drawing to indicate its position and size.
setEditableRegionHighlightModeSets the global editable region highlight mode.
setEditModeSets a value indicating whether the document's text is protected, or can be freely edited and formatted.
setFileDirectoryObsolete. This method will be removed in one of the next versions. For security reasons, the setFileDirectory method has been removed. Please set the file directory on the server side using the TXTextControl.Web.MVC.TextControl.SetFileDirectory or WebSocketHandler.SetFileDirectory method. Sets the directory path where the files of a specific file type are stored on the web server.
setFontUnderlineStyleSets underlining style for the text displayed by the control. This property only determines the style.
setForeColorSets the foreground color of the control which is the color of the document's text.
setFormattingPrinterSets 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.
setFormulaReferenceStyleSets 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.
setInputPositionByLocationSets a new input position from a geometric location.
setInputPositionByPageSets a new input position from a page, line and column number.
setInputPositionByTextPositionSets a new input position from a text position.
setInsertionModeSets the insertion mode.
setIsFormFieldValidationEnabledSets a value indicating whether form field validation is active or not.
setIsFormulaCalculationEnabledSets a value indicating whether formulas in tables are automatically calculated when the text of an input cell is changed.
setIsHyphenationEnabledSets a value indicating whether hyphenation is active or not.
setIsLanguageDetectionEnabledSets a value indicating whether language detection is active or not.
setIsSpellCheckingEnabledSets a value indicating whether spell checking is active or not.
setIsTrackChangesEnabledSets a value indicating whether track changes is active or not.
setLandscapeSets a value indicating whether the page orientation is landscape.
setPageUnitSets the measure used for page sizes and page margins.
setPermanentControlCharsSets a value indicating which control characters are shown permanently on the screen.
setRenderModeSets the component render mode. This property only works with the Microsoft Windows based .NET 4 backend. With the platform independent backend, an error is thrown because there is only the SVG based render mode.
setSelectObjectsSets a value controlling the selection of objects which are inserted behind the text. When the property is set to true, a mouse click selects the object behind the text. Otherwise, when this property is set to false, text in front of the object can be selected.
setStatusBarColorSets the background color of the status bar.
setTextSets the control's text.
setTextBackColorSets the background color for the text.
setTextFrameMarkerLinesSets whether text frames that have no border line are shown with marker lines.
setViewModeSets the mode how Text Control displays a document.
showDialogShows a built-in dialog box.
showHorizontalRulerShows or hides the web editor's horizontal ruler bar.
showHtmlDialogShows one of the a built-in HTML dialog boxes.
showMergeFieldDialogOpens a field dialog either for changing properties of an existing merge field or for creating a new merge field. If the fieldType parameter is omitted, the field dialog for the merge field at the current input position is shown (if there is one). Setting the fieldType parameter to a valid value creates a new field or replaces the field at the current position.
showRibbonBarShows or hides the ribbon bar.
showSideBarShows or hides a specified side bar.
showStatusBarShows or hides the web editor's status bar.
showVerticalRulerShows or hides the web editor's vertical ruler bar.
undoUndoes the last Text Control operation.
zoomZooms the contents of the TextControl.

Enumerations

EnumerationDescription
ActivationStateThe current activation state. It can be activated, deactivated or disabled.
AddResultSpecifies the result when a subtextpart has been added to the document. The object has the following properties:
AppendSettingsDetermines how text is appended to the document.
ApplicationFieldFormatThe possible application field formats.
AutoBaselineSpecifies how text is automatically sub- or superscripted.
AutoGenerationTypeDefines the type of document link auto-generation.
BarcodeAlignmentDetermines the alignment of the barcode image inside the control.
BarcodeTextAlignmentDetermines the alignment of the barcode text and additional text that is displayed inside the control.
BreakTypeSpecifies where and how a text or section breaks.
CapitalizationSettingsSpecifies the settings for capitalization.
CapitalsSpecifies whether the lowercase letters of text are displayed with capital letters.
ChangeKindSpecifies the kind of a tracked change.
ClipboardModePossible clipboard modes.
ComponentRenderModeComponent render mode.
ContextMenuLocationDetermines the location in the document where a context menu will be shown.
ControlCharsDetermines values for the control characters used in a TextControl document.
DialogBoxKindPossible built-in dialog box types.
DirectionDetermines the writing direction of a paragraph.
DocumentAccessPermissionsSpecifies how a document can be accessed after it has been opened.
EditModeDetermines the possible document edit modes.
FieldTypeDetermines the possible MS Word specific merge field types supported by the TX Text Control JavaScript API.
FileTypeSpecifies the kind of file types. The object has the following properties:
FindOptionsDetermines search options for the find method.
FontUnderlineStyleSpecifies the style of the underline below a text.
FormulaReferenceStyleSpecifies the style of references to table cells in formulas.
FrameDetermines which frame borders are visible of an image, text frame, chart, barcode or drawing.
FrameInsertionModeDetermines how the frame of an image, text frame, chart, barcode or drawing can be inserted in the text.
FrameStyleDetermines the style of a frame of an image, text frame, chart, barcode or drawing. The object has the following properties:
HeaderFooterTypeDetermines the type of a header or footer.
HighlightModeContains all possible highlight mode values.
HorizontalAlignmentSpecifies the horizontal alignment of a text.
HtmlDialogBoxKindPossible built-in HTML based dialog box types.
ImageFormatSpecifies the file format of an image.
ImageInsertionModeDetermines how an image can be inserted in the text.
InsertionModeDetermines how text is inserted at the current input position when text is typed or inserted.
JustificationSpecifies the kind of justification.
ListFormatCharacterSpecifies the list format character.
ListTypeSpecifies the type of a list.
MeasuringUnitSpecifies the measuring unit.
MergeFieldTextFormatDetermines the possible text formats for merge fields containing text.
MisspelledWordKindSpecifies the kind of a misspelled word.
NumberFormatSpecifies the format of a numbered list.
PageContentDefines the contents of a page's image returned from the Page.getImage method.
PermanentControlCharDefines a control character which is shown permanently on the screen.
RelationalOperatorDetermines the relational operator used by some types of merge fields.
RulerBarBorderStyleThe border style of a ruler bar.
RulerBarFormulaModeSpecifies whether a ruler bar shows cell references when the current input position is in a table cell.
RulerBarScaleUnitSpecifies whether a ruler bar shows cell references when the current input position is in a table cell.
SectionBreakKindSpecifies the kind of a section break.
SideBarTypeSpecifies the existing side bar types.
SpecialZoomFactorDetermines the special zoom factor values for property TXTextControl.zoomFactor.
StatusBarBorderStyleObsolete. This enumeration will be removed in one of the next versions. Since version 33.0 it's not possible to change the border style of the status bar anymore. The border style of a status bar.
StreamTypeDetermines a certain text format.
TableAddPositionSpecifies the position where to split the table.
TabLeaderDefines how a tab gap is filled.
TabTypeDetermines the tabulator type.
TextFieldPositionSpecifies special text input positions at the beginning and the end of a text field.
TextFieldTypePossible types of text fields.
TextFrameInsertionModeDetermines how a text frame can be inserted in the text.
TextTypeSpecifies how a text is represented and interpreted.
VerticalAlignmentSpecifies the vertical alignment of a text.
ViewModeThe mode how Text Control displays a document.
ZOrderSpecifies how the z-order of a frame (image, text frame, chart, barcode or drawing) can be changed.

Further Reading

  • Signing Documents with the Angular DocumentViewer –
  • Angular: Loading Documents on Initializing TX Text Control –