TX Text Control .NET for WPF

What's New in TX Text Control .NET for WPF 32.0

Topic

Footnotes are the headline of version 32.0: TX Text Control .NET for WPF inserts, numbers and edits them, in code and in the ribbon. The version also renders document pages as SVG, adds undo steps for headers and footers, and lets you change the [Normal] style that all other styles inherit from.

Version 32.0 was released in September 2023, together with TX Text Control .NET Server, TX Text Control .NET for Windows Forms and TX Text Control ActiveX 32.0. The current version is Version 34.0. The service packs of 32.0, among them Service Pack 2 with its new licensing, are listed on Service Packs.

Version 32.0 at a Glance

AreaWhat is new
FootnotesFootnotes in documents and the API, six events of TextControl, ribbon items, a search option and a context menu location
PagesSVG images of document pages
EditingAn undo step for headers and footers, removing the formatting of a selection, an editable [Normal] style
Dialog boxesFormat detection and preselection in the open file and insert image dialog boxes
.NETA package for .NET 5 and higher, for .NET 6 and higher from Service Pack 2

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 added footnotes to documents and to the API. Footnotes are part of the Enterprise edition; see Editions and Feature Availability.

  • The API. TextControl.Footnotes, a FootnoteCollection, inserts, finds and removes Footnote objects and sets the start number, number format and highlighting of all footnotes. ServerTextControl.Footnotes does the same without a user interface.
  • Events. TextControl raises six events when a footnote is created or deleted, when the input position enters or leaves a reference mark and when the footnote section of a page is activated or deactivated. ServerTextControl raises the first two.
  • Numbering and content. Footnotes are renumbered when one is inserted in front of others, and their text can contain all formatting, tables and images. Headers, footers and text frames can't hold footnotes.
  • File formats. Footnotes are saved in the TX Text Control format, RTF, DOC and DOCX.

Footnotes shows how to insert, number, find and remove footnotes and how to handle their events. The blog article Sneak Peek 32.0: Introducing Footnotes shows footnotes with formatted text and tables.

Footnotes in the User Interface

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. In code, the enumeration is written Page.PageContent. You get the pages of a document from GetPages, which returns pages only when the ViewMode of TextControl is PageView.
  • 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 the overload describes outline curves only, and the overload has no parameter that selects text output.

The overload is an addition, so existing calls of GetImage keep working.

Other 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 of TextControl 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. See Undo and Redo.
  • 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.
  • The [Normal] style. The [Normal] style, which all other styles of a document inherit from, can be changed, and the change applies to every style based on it. The style is saved with the document. The blog article Sneak Peek 32.0: Modifying the Normal Stylesheet shows it; see also Stylesheets.
  • File dialog boxes. The open file and insert image dialog boxes detect the format of a file from its extension and preselect the format opened last when they open again. See Loading and Saving Documents.

.NET

The package TXTextControl.TextControl.WPF.SDK of version 32.0 targeted .NET 5 and higher. Service Pack 2 changed the target to .NET 6 and higher, and it introduced the license file that replaces licenses.licx in .NET projects. Text Control tested version 32.0 with the final release of .NET 8; see the blog article TX Text Control Supports .NET 8 in Windows Forms and WPF Applications. Since version 33.0, the package requires .NET 8 or higher.

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 for WPF, grouped by class. Each name leads to its reference page. The On methods, such as OnFootnoteCreated, are protected methods that raise the event of the same name. The list of the documentation also names the HeaderFooter class and members of it that existed before version 32.0, such as Distance, Images and Activate, and they are left out here. The two EntryAssembly properties came with Service Pack 2.

Upgrade to Version 32.0

The update notes of version 32.0 list only the new SVG overload of Page.GetImage, which doesn't require code changes. Since Service Pack 2, .NET projects use the license file txtextcontrol.wpf.license instead of licenses.licx, and a class library or user control sets TextControl.EntryAssembly. Breaking Changes in the Upgrade Guide describes what to change, and Upgrading from Previous Versions has the steps.

Next Steps