What's New in TX Text Control .NET Server 32.0
Footnotes, SVG images of document pages and a Document Editor that starts from plain JavaScript came with version 32.0. The sections below go through the features, classes, properties, methods and events the version added since 31.0, with a link to the page that covers each of them.
Version 32.0 was released in September 2023, together with TX Text Control .NET for Windows Forms, TX Text Control .NET for WPF and TX Text Control ActiveX 32.0. The current version is Version 34.0. The changes of the 32.0 service packs are listed on Service Packs.
Version 32.0 at a Glance
| Area | What is new |
|---|---|
| Document processing | Footnotes, SVG images of pages, an undo step for headers and footers, removing the formatting of a selection |
| Document Editor | Initialization with JavaScript, SVG render mode, faster initialization, HTML dialogs, footnotes, dictionaries, an event per ribbon tab |
| Accessibility | ARIA attributes and roles in the ribbon bar |
Footnotes
A footnote has two parts: a reference mark in the text and the footnote itself at the bottom of the page. Version 32.0 adds footnotes to documents and to the API: ServerTextControl.Footnotes returns the FootnoteCollection of the document, with a Footnote object for each footnote. Footnotes shows how to insert, number, read, format and remove them in code, and Footnotes in the Document Editor how users insert them.
- Highlighting. FootnoteCollection.HighlightMode highlights the numbers of all footnotes
Always,Never(the default) or only when the number contains the input position (Activated). Footnote.HighlightMode and HighlightColor change this for a single footnote. - Server Visualization. ServerVisualization.TextViewGenerator raises events when the input position moves to or away from a reference mark and when the footnote section of a page gets or loses the input position.
The blog article Sneak Peek 32.0: Introducing Footnotes shows footnotes with formatted text and tables.
SVG Images of Pages
Version 32.0 can render a page of a document as Scalable Vector Graphics (SVG), a vector image format.
- Page.GetImage. A new overload of Page.GetImage returns a page as a string in SVG format. Its first parameter, a PageContent value, selects the parts of the page, such as the main text or the headers and footers. You get the pages of a document from GetPages.
- What the SVG contains. Characters are stored as outline curves (cubic Bézier splines), coordinates are in twips, and pixel images are embedded as PNG. The second parameter sets the maximum resolution of these images in dpi. An SVG image in the document is embedded unchanged, including its script data. The feature description of version 32.0 also names text with font information as a second way of storing characters, but the reference of both overloads describes outline curves only, and neither overload has a parameter that selects text output.
- View.GetImage. A new overload of ServerVisualization.View.GetImage returns a part of the view as SVG: a rectangle or a range of lines.
Both overloads are additions, so existing calls of GetImage keep working. The blog article How to Generate SVG Images from Document Pages in ASP.NET Core C# returns SVG thumbnails of all pages from a Web API.
Other Document Processing Additions
- Undo for headers and footers. Changes that your code makes through the properties and methods of a header or footer aren't added to the undo stack automatically. HeaderFooter.AddUndoUnit adds the current state of the header or footer to it. When a user edits the text or its formatting, the call isn't needed.
- Remove formatting. Selection.RemoveFormatting resets the character formatting of the selected text to its defaults. If nothing or more than one paragraph is selected, it resets the paragraph formatting as well.
Document Editor
The Document Editor is the WYSIWYG word processor that you embed in your web application.
- Initialization with JavaScript. TXTextControl.init creates the editor in a plain HTML page. It takes a ComponentSettings object with the container element and the WebSocket address of the backend, and optional DocumentEditorSettings in editorSettings, such as the culture, the edit mode, the WebSocket subprotocols, customQueryParams for custom query parameters and formattingPrinter, the printer whose text dimensions format the document. With replaceContainer, the editor replaces the container element instead of being added to it as a child, and domContentLoaded is a handler that is called as soon as the editor's elements have been inserted into the page. Before 32.0, the editor required a client package for Angular, Node.js, Web Forms or ASP.NET Core MVC. The backend serves the editor script at
/api/TXWebSocket/GetResource?name=tx-document-editor.min.js. JavaScript in Getting Started uses this initialization. - SVG render mode. The editor can render the main text as SVG instead of bitmaps, which speeds up the display over slow connections or with high ping times. setRenderMode selects
Bitmap,VectororAutofrom the ComponentRenderMode enumeration; withAuto, the editor chooses from the network conditions and the screen resolution. The cross-platform backend introduced in version 33.0 renders only SVG, andsetRenderModethrows an error with it. - Faster initialization. The editor loads its resources and the ribbon content over two WebSocket connections at the same time. Users can type and use the first ribbon tab as soon as the document is loaded.
- An event for each ribbon tab. The
ribbonTabLoadedevent fires once for each ribbon tab. Its RibbonTabLoadedEventArgs contain the name and the HTML element of the tab, so you can change or remove the tab. The blog article Document Editor: Initialization Events shows the events of the initialization. - HTML dialogs. showHtmlDialog opens a built-in dialog, for example the options, spell check, thesaurus, bookmark or hyperlink dialog. The dialogs are the values of HtmlDialogBoxKind.
- Footnotes. The ribbon has buttons to insert, delete and change footnotes. In the JavaScript API, TXTextControl.footnotes holds a FootnoteCollection with an add method, and the editor raises the events
footnoteCreated,footnoteDeleted,footnoteReferenceMarkEntered,footnoteReferenceMarkLeft,footnoteSectionActivatedandfootnoteSectionDeactivated. - Dictionaries. Proofing.getDictionaryList lists the dictionary files on the server and whether each is loaded. loadDictionary and removeDictionary load and unload one.
- Form fields and text fields. flattenFormFields converts all form fields to static text. SubTextPart.getTextFields and FormattedText.getTextFieldsByType return the fields of the types you select with TextFieldType.
- Drag and drop. setAllowDrag sets whether the editor can be the source of a drag-and-drop operation, and setAllowDrop whether it accepts dropped data.
- Connection ID. connectionID returns the unique ID of the editor's connection.
Web Accessibility
The ribbon bar of the Document Editor uses ARIA attributes and roles, and in some cases alt and title attributes, so that screen readers can read it.
.NET
Text Control tested version 32.0 with the early versions and the final release of .NET 8. The blog article TX Text Control Supports .NET 8 in ASP.NET Core Applications describes the tests. Since version 33.0, the NuGet packages require .NET 8 or higher; see .NET Versions.
New Classes and Members
The What's New documentation of version 32.0 lists these classes, properties, methods and events as new in TX Text Control .NET Server, grouped by class. Each name leads to its reference page. The list of the documentation also names members of HeaderFooter that existed before version 32.0, such as Distance, Images and Activate, and they are left out here. ServerTextControl.EntryAssembly came with Service Pack 2.
.NET API
- Footnote (new class): DefaultHighlightColor, Edit, HighlightColor, HighlightMode, ID, Name, Number, ReferenceMarkLength, ReferenceMarkStart, Save, ScrollTo, Text
- FootnoteCollection (new class): Add, CopyTo, Count, GetEnumerator, GetItem, HighlightMode, Item, NumberFormat, Remove, StartNumber
- FootnoteEventArgs (new class): Footnote
- FootnoteSection (new class)
- FootnoteText (new class)
- HeaderFooter: AddUndoUnit
- Selection: RemoveFormatting
- ServerTextControl: EntryAssembly, FootnoteCreated, FootnoteDeleted, Footnotes, OnFootnoteCreated, OnFootnoteDeleted
- ServerVisualization.TextViewGenerator: FootnoteReferenceMarkEntered, FootnoteReferenceMarkLeft, FootnoteSectionActivated, FootnoteSectionDeactivated, OnFootnoteReferenceMarkEntered, OnFootnoteReferenceMarkLeft, OnFootnoteSectionActivated, OnFootnoteSectionDeactivated
Document Editor JavaScript API
- ComponentSettings: containerElement, containerID, domContentLoaded, editorSettings, replaceContainer, webSocketURL
- DictionaryInfo: fileName, isLoaded
- DocumentEditorSettings: connectionID, contextMenusEnabled, culture, customQueryParams, editMode, formattingPrinter, reconnectTimeout, uiCulture, userNames, webSocketProtocols
- Footnote: edit, getHighlightColor, getHighlightMode, getID, getName, getNumber, getReferenceMarkLength, getReferenceMarkStart, scrollTo, scrollToPosition, setHighlightColor, setHighlightMode, setID, setName
- FootnoteCallbackData: added, footnote
- FootnoteCollection: add, getDefaultFootnoteHighlightColor, getHighlightMode, getNumberFormat, getStartNumber, remove, setHighlightMode, setNumberFormat, setStartNumber
- FootnoteEventArgs: highlightColor, highlightMode, id, name, number, referenceMarkLength, referenceMarkStart
- FormattedText: getTextFieldsByType
- Proofing: getDictionaryList, loadDictionary, removeDictionary
- RibbonTabLoadedEventArgs: elemTab, tabName
- SubTextPart: getChildren, getTextFields
- TXTextControl: connectionID, flattenFormFields, footnotes, getAllowDrag, getAllowDrop, getRenderMode, init, setAllowDrag, setAllowDrop, setRenderMode, showHtmlDialog
Upgrade to Version 32.0
- Update notes. The update notes of version 32.0 list the two new SVG overloads of
Page.GetImageandView.GetImage. They don't require code changes. - Changes to plan for. ASP.NET Core applications that use the Document Editor must change the middleware call in Program.cs. Breaking Changes describes this and the other changes of 32.0.
- Service packs. Service Pack 2 changed the licensing of .NET applications and added ServerTextControl.EntryAssembly for class libraries, and Service Pack 3 added SVG images to mail merge. See Service Packs.
Next Steps
- Version 33.0: the features of the next version.
- Version 31.0: the features of the previous version.
- Breaking Changes: the changes that can require work when you upgrade.
- JavaScript: add the Document Editor to an HTML page with
TXTextControl.init.