What's New in TX Text Control 16.0
TX Text Control 16.0 opened the text of a document to a common interface: the main text, text frames and headers and footers became text parts with the same members. The version also added a spell checker interface, table headers that repeat on every page and nested merge blocks, and it changed several types that code written for version 15.1 uses.
Version 16.0 was released in November 2010, as the blog article TX Text Control 16.0 Has Just Been Released announced. It was the first version with a WPF edition, TX Text Control .NET for WPF, and its server products were TX Text Control Server for ASP.NET (incl. Windows Forms) and TX Text Control Server for ASP.NET (incl. WPF). Features of the Windows Forms and WPF controls, such as the WPF controls themselves, ribbon support through data binding and Windows Forms controls in browser applications, aren't listed here; their breaking changes are, because they affect the shared assemblies.
Version 16.0 at a Glance
| Area | What is new |
|---|---|
| Text parts | TextPartCollection, the IFormattedText interface and the MainText class |
| Spell checking | An interface for any spell checker, with the SpellCheckText event |
| Tables | Header rows that repeat on each page |
| Mail merge | Nested merge blocks, image merge fields, access to the merged data |
| Formatting | Indents and font sizes changed in steps, the InputFormat class |
| Page size | The PageSize class and a unit for page sizes and margins |
Text Parts
A document consists of its main text and further pieces of text: text frames and headers and footers.
- All text parts. ServerTextControl.TextParts returns a TextPartCollection with all text parts of the document in geometric order: first the main text, then the text frames, then the headers and footers. Activate moves the input position into a text part, and GetItem returns the active one.
- One interface. Every text part implements IFormattedText, which provides its lines, paragraphs, characters, selection, tables, images, text fields, hypertext links, application fields and misspelled words, and a Find method.
ServerTextControl,TextFrame,HeaderFooterandMainTextimplement it. - Main text. A MainText object stands for the main text. Its collections always belong to the main text, while the collections of the control belong to the text part that has the input focus.
Subtext Parts covers text parts and subtext parts in the current version.
Spell Checking
TX Text Control got an interface that connects any spell checker:
- The event. Each time the text changes, the SpellCheckText event passes the text to check in its SpellCheckTextEventArgs. The handler returns the positions of all misspelled words as an array of MisspelledWord objects in MisspelledWords.
- Activation. Spell checking works only when ServerTextControl.IsSpellCheckingEnabled is
true. TextField.IsSpellCheckingEnabled excludes a text field. - The misspelled words. ServerTextControl.MisspelledWords returns a MisspelledWordCollection; headers, footers and text frames have the same property.
Spell Checking and Hyphenation covers spell checking in the current version.
Tables, Formatting and Pages
- Table headers. One or more rows marked with TableRow.IsHeader form the header of a table, which is repeated at the top of each page, or of each column, the table extends over. See Tables.
- Indents and font sizes. Selection.IncreaseIndent, DecreaseIndent, GrowFont and ShrinkFont change the indents or the font size of the selection by one step.
- Input format. The InputFormat class has a property for each character and paragraph attribute at the input position, which is updated whenever the input position changes. On the server, Version 21.0 made it available through
ServerVisualization.TextViewGenerator.InputFormat. - Page size. A PageSize object with Width and Height describes the page size, and ServerTextControl.PageUnit sets the unit of page sizes and page margins.
Mail Merge
- Nested merge blocks. MailMerge merges nested merge blocks: it descends through the blocks and merges each with the related data. See Nested Blocks.
- Images. Merge fields whose name starts with
image:are filled with images, for example to always merge the current company logo. The ImageFieldMerged event gives access to the merged image as anImageobject through ImageFieldMergedEventArgs. - Merged data. DataRowMergedEventArgs.MergedRow and FieldMergedEventArgs.MergedField return the merged data in the internal TX Text Control Unicode format, and a handler can change it.
- Template information. GetBlockNames lists the names of all merge blocks of the loaded template.
- Whitespace. RemoveTrailingWhitespace removes trailing whitespace before the document is saved. Its default value is
true.
Upgrade to Version 16.0
Version 16.0 changed types and assemblies. Code written for earlier versions has to be adapted:
- Page margins. The properties Left, Top, Right and Bottom of PageMargins are of the type
doubleinstead ofint. - Page size. ServerTextControl.PageSize, and
PageSizeof the Windows FormsTextControl, are of the typePageSizeinstead ofSystem.Drawing.Size. - Dialog results. The overloads of Selection.Load that open a dialog box return a
Selection.DialogResultvalue instead ofSystem.Windows.Forms.DialogResult. - Browser controls removed. The classes
BrowserTextControl,BrowserButtonBar,BrowserRulerBarandBrowserStatusBarwere removed. Replace them withTextControl,ButtonBar,RulerBarandStatusBar. - Assemblies. TXTextControl.dll was split into TXTextControl.dll and TXTextControl.Windows.Forms.dll.
New Classes, Properties, Methods and Events
The classes and members below are the ones that the What's New documentation of version 16.0 lists for TX Text Control .NET Server. Names are relative to the TXTextControl namespace, each name links to its current reference page, and "(obsolete)" marks a member that is obsolete today.
New Classes
- DocumentServer.MailMerge.ImageFieldMergedEventArgs
- InputFormat
- MainText
- MisspelledWord
- MisspelledWordCollection
- PageSize
- SpellCheckTextEventArgs
- TextPartCollection
Members by Class
Next Steps
- Version 17.0: the features of the next version.
- Version 15.1: the frame base class, document-wide image export and supported fonts.
- Breaking Changes: the changes of the current versions that need work in an upgrade.