What's New in TX Text Control .NET for WPF 29.0
Tables of contents, files embedded in PDF documents and the DocumentSettings class arrived in TX Text Control .NET for WPF with version 29.0, each with a user interface: the References ribbon tab, a table of contents dialog box and a sidebar for the document settings. The version also made barcodes part of TX Text Control and added a namespace that reads AcroForm fields and searches the text of PDF documents.
Version 29.0 was released on December 2, 2020, as TX Text Control X19, together with TX Text Control .NET Server, TX Text Control .NET for Windows Forms, TX Text Control ActiveX and TX Spell .NET 8.0. Its last full installer, that of Service Pack 3, is dated July 21, 2021. The features below are the ones added since version 28.0; the next version is Version 30.0.
Version 29.0 at a Glance
| Area | What is new |
|---|---|
| Document structure | Tables of contents generated from structure levels, with a ribbon tab and a dialog box |
| Document settings | Author, title and other settings of the open document, with a sidebar to edit them |
| Embedded files, AcroForm import, text search in PDF documents | |
| Mail merge | Filters and sorting instructions of existing merge blocks changed in code |
| Barcodes | TX Barcode .NET integrated into TX Text Control, with the WPF control TXBarcodeControl |
| Subtext parts | The nested subtext parts and the text fields of a subtext part |
Tables of Contents
A table of contents is generated from the structure level of the paragraphs in a document. Tables of Contents describes the feature as it is today.
- Structure levels. ParagraphFormat.StructureLevel sets the level of a paragraph, from 0 (body text) to 10, and the paragraph dialog box received a field for it.
- API. The TableOfContents class and the collection TextControl.TablesOfContents create, update and link tables of contents, and
TextControlraises four events when one is created, deleted, entered or left. The entries are formatted with the stylesTOC_Title,TOC_Level1and so on. - User interface. TextControl.TableOfContentsDialog and the new RibbonReferencesTab let users insert and change a table of contents.
- Tab leaders. ParagraphFormat.TabLeaders, also new, sets the characters that fill the space before a tab position, such as the dots before a page number.
PDF Documents
Version 29.0 extended both directions of the PDF support: files can be embedded when a PDF is saved, and a new namespace reads data out of existing PDF documents.
- Embedded files. EmbeddedFile holds a file and its data, with optional properties such as the MIME type, the relationship, a description and dates. LoadSaveSettingsBase.EmbeddedFiles, available as
SaveSettings.EmbeddedFilesandLoadSettings.EmbeddedFiles, embeds files when a PDF is saved and returns them when a PDF is loaded. To load them, LoadSettings.PDFImportSettings has to includeLoadEmbeddedFiles. See Attachments. - AcroForm import. DocumentServer.PDF.Forms.GetAcroFormFields returns the form fields of a PDF document as AcroForms.FormField objects: text fields, check boxes, choice fields, combo boxes, list boxes, radio buttons and buttons. Its typical use is reading the values of a form that users filled out. See Reading Form Fields and Values.
- Text search. DocumentServer.PDF.Contents.Lines.Find searches the lines of a PDF document for a string, a regular expression or a geometric position and returns ContentLine objects with the text, the page and the position of each line. See Text Extraction.
Document Settings
TextControl.DocumentSettings returns a DocumentSettings object with the general settings of the document the user works on: author, creation date, creator application, base path, keywords, subject, title, embedded files and user-defined properties. The values can be changed while the document is open. Save stores them with the document, and a property of SaveSettings with the same name overrides a value for one save. See Document Properties.
The Document Settings Sidebar
The Sidebar received a document settings layout, the value DocumentSettings of SidebarContentLayout, in which users manage the settings of the document:
- Text boxes for the title, the author, the subject and the keywords. The creation date is set to the current date when the content of the
TextControlis reset, and shows the document's creation date after a document is loaded. - Custom Properties lists the user-defined properties. Add... opens a dialog box for a new property, and Delete removes one.
- Embedded Files in PDF lists the embedded files. They are filled only when
LoadSettings.PDFImportSettingsincludesLoadEmbeddedFiles, and they are saved only with PDF documents. Add... chooses a file and determines its MIME type from the file extension, Edit... changes its MIME type, relationship and description, Save... stores it in a file and Remove deletes the entry.
A control of the layout that an application doesn't need can be hidden or removed: the DocumentSettingsItem enumeration names each item, and FrameworkElement.FindName returns it. Sidebar and Panels shows how.
Mail Merge
MailMerge creates documents from a template and data. Its repeating merge blocks, sections of the template that are repeated for each record, carry filter and sorting information since version 26.0, and version 29.0 made that information editable in code.
- MergeBlockInfo from an existing block. A new MergeBlockInfo constructor creates the object from a merge block of a template, a SubTextPart. The object then contains the block's Filters, SortingInstructions, merge fields, child blocks and the name of its data table.
- Write it back. After the information is changed, MergeBlockInfo.Apply stores it in the document.
Sorting and Filtering describes filters and sorting instructions.
Subtext Parts
SubTextPart.GetChildren returns the subtext parts nested in a subtext part, and SubTextPart.GetTextFields the text fields it contains. See Subtext Parts.
Barcodes
The barcode component TX Barcode .NET became part of TX Text Control, so barcodes no longer need a separate product.
- The WPF control. WPF.Barcode.TXBarcodeControl is a WPF element that displays a barcode. Its properties set the barcode type, the text, the colors, the alignment and the angle, and its methods check a text for the chosen type, save the barcode and save it as an image.
- In a document. A barcode is a BarcodeFrame in a BarcodeCollection, returned by TextControl.Barcodes, and is positioned like an image or a text frame.
- Check values. The new Barcode.BarcodeTypeSettings class sets whether a barcode has a check value and whether it shows it.
See Charts and Barcodes and Integrating WPF Barcodes and Drawings.
Upgrade to Version 29.0
- Update notes. The update notes of version 29.0 list one entry: LoadSettings.PDFImportSettings was extended with the settings
LoadEmbeddedFiles,LoadMetadataandGenerateXMLAsEmbeddedFile. Of the three, onlyLoadEmbeddedFilesis a value of the current PDFImportSettings enumeration. Today, the metadata, the form fields and the text coordinates of a PDF document come fromLoadEmbeddedDataand LoadSettings.EmbeddedData. The What's New documentation of version 30.0 repeats the same entry. - Breaking changes. No change of version 29.0 is known to break existing code. Breaking Changes starts with version 30.0.
New Classes, Properties, Methods and Events
These are the classes and members that the What's New documentation of version 29.0 lists for TX Text Control .NET for WPF. Names are relative to the TXTextControl namespace. Each name links to its current reference page.
New Classes
- Barcode.BarcodeTypeSettings
- DocumentLink
- DocumentServer.PDF.AcroForms.FormButton
- DocumentServer.PDF.AcroForms.FormCheckBox
- DocumentServer.PDF.AcroForms.FormChoiceField
- DocumentServer.PDF.AcroForms.FormComboBox
- DocumentServer.PDF.AcroForms.FormField
- DocumentServer.PDF.AcroForms.FormListBox
- DocumentServer.PDF.AcroForms.FormRadioButton
- DocumentServer.PDF.AcroForms.FormTextField
- DocumentServer.PDF.Contents.ContentLine
- DocumentServer.PDF.Contents.Lines
- DocumentServer.PDF.Forms
- DocumentSettings
- DocumentTarget
- EmbeddedFile
- TableOfContents
- TableOfContentsCollection
- TableOfContentsEventArgs
- WPF.Barcode.TXBarcodeControl
- WPF.RibbonReferencesTab
.NET Members by Class
Next Steps
- Version 30.0: the features of the next version.
- Version 28.0: the features of the previous version.
- Older Versions: all versions from 29.0 back to 10.1.
- TX Text Control X19 and TX Spell 8.0 Have Been Released: the release announcement on the Text Control Blog.