TX Text Control .NET Server

What's New in TX Text Control .NET Server 23.0

Topic

Drawings, subtext parts and document properties are the additions of version 23.0 that TX Text Control .NET Server still builds on. The version also changed how merge blocks are stored in mail merge templates, and it let the Document Editor connect to the TX TextControl Service on another server.

Version 23.0 was released on December 9, 2015, as TX Text Control X13, together with TX Text Control .NET for Windows Forms, TX Text Control .NET for WPF and TX Text Control ActiveX. Its last full installer, that of Service Pack 1, is dated August 8, 2016. The features below are the ones added since version 22.0.

Version 23.0 at a Glance

AreaWhat is new
DrawingsDrawings and preset shapes compatible with MS Word
Formatted textSubtext parts, collections for all text parts, symbol characters, Unicode bullets
DocumentsAuthor, dates, keywords and subject saved with every format
Mail mergeMerge blocks as subtext parts, MergeObject, the BlockMerging event
Document EditorCulture settings, a service on another server, an ASP.NET MVC helper, loading and saving in JavaScript

Drawings and Shapes

TX Text Control supports drawings and the preset shapes of ISO/IEC 29500-1, section 20.1.10.55. A drawing is a single shape or a canvas with several shapes. See Text Frames and Shapes and, for the Document Editor, Shapes.

  • Positioning. A DrawingFrame positions the drawing like an image or a text frame: as a single character, anchored to a paragraph or at a fixed position in the document. DrawingFrame.Drawing returns the drawing itself, whose shapes are in a Drawing.ShapeCollection.
  • The collection. ServerTextControl.Drawings returns the DrawingCollection, which adds and removes drawings. DrawingCreated and DrawingDeleted report the changes.
  • File formats. Drawings are saved and loaded with the TX Text Control format and DOCX. Other formats save the drawing's image.
  • Editor. Users can activate a drawing and change its shapes with the mouse and the keyboard. The editor's server side received a dialog box for the layout of drawings, the value DrawingLayoutDialog of TextViewGenerator.DialogBoxKind.

Subtext Parts

The main text, text frames, headers and footers are the text parts of a document. A SubTextPart is a smaller piece of text that you define to work on it separately. See Subtext Parts.

  • Defining one. A subtext part is defined by a start position and a length or by a selection. ServerTextControl.SubTextParts returns the SubTextPartCollection of the main text, which adds and removes subtext parts; text frames, headers and footers have their own.
  • Name, ID and highlighting. A subtext part has a name and an ID. It can be highlighted always or only while it contains the input position, set with HighlightMode.
  • Nesting. Subtext parts can contain other subtext parts, but they can't overlap.
  • Saving. SubTextPart.Save saves the content to a byte array or a string, in every format TX Text Control supports.
  • Loading. LoadSettings.LoadSubTextParts converts bookmarks that span several characters in DOCX, DOC and RTF documents to subtext parts.

Formatted Text

  • Collections for all text parts. Document links, document targets, frames, charts, barcodes and drawings are available in every text part: the main text, headers, footers and text frames. IFormattedText.Drawings is one of the new properties.
  • Symbol characters. TextCharCollection.Add received overloads that add symbol and control characters in code.
  • Bullets. The bullet of a list is no longer limited to the Windows Symbol font. ListFormat.FontName sets its font, and ListFormat.BulletCharacter can be any Unicode character. See Paragraphs.

Document Properties

General document properties are saved with every supported format: SaveSettings.Author, CreationDate, CreatorApplication, DocumentKeywords, DocumentSubject and LastModificationDate. After a document is loaded, the properties of the same names of LoadSettings, such as LoadSettings.Author, return them. See Document Metadata.

Mail Merge

MailMerge creates documents from a template and data.

  • Merge blocks as subtext parts. Merge blocks, the sections of a template that are repeated for each record, are stored as subtext parts instead of document targets. Templates with blocks in the old format still load. See Merge Blocks.
  • A single object. MailMerge.MergeObject merges one object. Before, a single record of object data had to be wrapped in an enumerable type such as an array or a list. See Data Sources.
  • Empty blocks and images. RemoveEmptyBlocks removes the content of merge blocks without data (default true), and RemoveEmptyImages removes images without merge data (default false). See Conditional Content.

The Data of a Merge Block

The BlockMerging event occurs before a merge block is merged. Its BlockMergingEventArgs contain the name of the block, the column names of its table and, in BlockData, the data rows. The event arguments derive from CancelEventArgs, so a handler can cancel the merge of the block.

The rows and tables of this data are described by two interfaces, also new in version 23.0:

InterfaceMembers
IDataRowAdapterItem returns the content of a column by its name, Table the table the row belongs to, and GetChildRows the rows of a child relation by its name, or null if the relation doesn't exist
IDataTableAdapterTableName, ColumnNames, Rows (the rows as IDataRowAdapter objects) and ChildTableNames, the names of the table's child relations

Document Editor

In version 23.0, the Document Editor was the ASP.NET Web Forms control Web.TextControl, which worked with the TX TextControl Service, a Windows service on the server. Both are legacy technologies today; .NET Framework Applications describes their deployment.

Connect to a Service on Another Server

The Web Forms editor and the ASP.NET MVC editor of this version communicate with the TX TextControl Service through a WebSocket handler. Before version 23.0, the service had to run on the same machine as the IIS web server that hosts the editor. Two properties let the WebSocket handler connect to a service on another server, for example behind a load balancer:

PropertySets
Web.TextControl.ServiceAddressThe IP address of the service, a System.Net.IPAddress. The default is 127.0.0.1, the local computer.
Web.TextControl.ServicePortThe port of the service, an int

Setting either property affects all instances of Web.TextControl. The properties aren't static only so that they appear in the Visual Studio designer. The ASP.NET MVC editor has the same two properties in TextControlSettings.ServiceAddress and TextControlSettings.ServicePort, which affect all instances of TextControlSettings.

ASP.NET Core applications of today's version don't use this service: they run the Document Editor backend, as Architecture explains.

Document Viewer

The Document Viewer of this version, DocumentServer.Web.DocumentViewer, received page animations, rounded page corners and ShowEditButton, which shows or hides the edit button.

Upgrade to Version 23.0

  • Merge block format. Templates created with version 23.0 store merge blocks as subtext parts. Templates with blocks in the old format, based on document targets, still load.
  • Update notes. TextViewGenerator.DialogBoxKind was extended with DrawingLayoutDialog, and BarcodeCollection.Add and TextFrameCollection.Add received the overloads for inserting a frame with the mouse.
  • Obsolete members. ListFormat.CharAfterNumber and CharBeforeNumber, which the list of version 23.0 names, are obsolete today; Deprecated APIs names their replacements.
  • Other breaking changes. 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 23.0 lists for TX Text Control .NET Server. .NET names are relative to the TXTextControl namespace. Each name links to its current reference page, and "(obsolete)" marks the members that are obsolete today. The list also names classes that existed before, such as SaveSettings and ListFormat, as it appears in that documentation. The reference marks the Charts property of FootnoteSection and FootnoteText as introduced in version 23.0, but both classes came with footnotes in version 32.0, so they are left out here.

New Classes

.NET Members by Class

ClassPropertiesMethodsEvents
DataVisualization.DrawingCollectionAdd, CopyTo, DeactivateItem, GetActivatedItem, GetItem, Remove
DataVisualization.DrawingEventArgsDrawingFrame
DataVisualization.DrawingFrameDrawing, ExportCompressionQuality, ExportFileName, ExportFilterIndex, ExportResolution, SaveModeActivate, AddUndoUnit, Refresh
DocumentServer.DataSources.IDataRowAdapterItem, TableGetChildRows
DocumentServer.DataSources.IDataTableAdapterChildTableNames, ColumnNames, Rows, TableName
DocumentServer.MailMergeRemoveEmptyBlocks, RemoveEmptyImagesMergeObjectBlockMerging
DocumentServer.MailMerge.BlockMergingEventArgsBlockData, BlockName, ColumnNames
DocumentServer.MailMerge.ImageMergedEventArgsMerged
DocumentServer.Web.DocumentViewerPageAnimationDuration, PageAnimations, RoundedPageCorners, ShowEditButton
Drawing.SelectionCanBringForward, CanBringToFront, CanSendBackward, CanSendToBack, ShapesBringForward, BringToFront, IsCommonValueSelected, SendBackward, SendToBack
Drawing.ShapeAngle, AutoSize, Bounds, CanFitToCanvas, Flip, Index, IsSelected, Location, Movable, ShapeFill, ShapeOutline, Sizable, Size, TypeFitToCanvas
Drawing.Shape.FillColor
Drawing.Shape.OutlineColor, Width
Drawing.ShapeCollectionItemAdd, Insert, Remove
Drawing.ShapeEventArgsShape
HeaderFooterBarcodes, Charts, DocumentLinks, DocumentTargets, Drawings, Frames, SubTextParts
IFormattedTextBarcodes, DocumentLinks, DocumentTargets, Drawings, Frames, SubTextParts
ListFormatBulletCharacter, BulletSize, CharAfterNumber (obsolete), CharBeforeNumber (obsolete), FirstNumber, FontName, FormatCharacter, HangingIndent, LeftIndent, Level, NumberFormat, RestartNumbering, Type
LoadSettingsAuthor, CreationDate, CreatorApplication, DocumentKeywords, DocumentSubject, LastModificationDate, LoadSubTextParts
MainTextCharts
SaveSettingsAuthor, BytesWritten, CreationDate, CreatorApplication, CssFileName, CssSaveMode, DocumentKeywords, DocumentSubject, DocumentTitle, ImageSavePath, LastModificationDate, PageMargins, PageSize, SavedFile, SavedStreamType
ServerTextControlDrawings, SubTextPartsOnDrawingCreated, OnDrawingDeletedDrawingCreated, DrawingDeleted
ServerVisualization.TextViewGeneratorDrawingMarkerLines, RedoActionName, UndoActionNameBeginUndoAction, EndUndoAction, OnDrawingDeselected, OnDrawingSelected, OnSubTextPartClicked, OnSubTextPartDoubleClicked, OnSubTextPartEntered, OnSubTextPartLeft, OnTextFieldClicked, OnTextFieldEntered, OnTextFieldLeftDrawingDeselected, DrawingSelected, SubTextPartClicked, SubTextPartDoubleClicked, SubTextPartEntered, SubTextPartLeft, TextFieldClicked, TextFieldEntered, TextFieldLeft
SubTextPartHighlightColor, HighlightMode, ID, Length, Name, NestedLevel, Number, OuterMostSubTextPart, OuterSubTextPart, Start, TextSave, ScrollTo
SubTextPartCollectionCount, IsSynchronized, Item, SyncRootAdd, CopyTo, GetEnumerator, GetItem, Remove
SubTextPartEventArgsSubTextPart
TextCharCollectionAdd, Remove
TextFrameBarcodes, Charts, DocumentLinks, DocumentTargets, Drawings, Frames, SubTextParts
TextFrameCollectionGetActivatedItem
Web.MVC.ControlBaseRender
Web.MVC.ControlsFactoryTextControl
Web.MVC.HtmlHelperExtensionTXTextControl
Web.MVC.TextControlLoadText, LoadXMLDatabase, SetFileDirectory
Web.MVC.TextControlSettingsAPIRoute, BackColor, ContextMenusEnabled, ControlChars, Culture, DatabaseFileDirectory, Dock, DocumentFileDirectory, DocumentTargetMarkers, EditMode, FormattingPrinter, Height, ImageFileDirectory, SaveDocumentQuestionDialogEnabled, ServiceAddress, ServicePort, StaticFilesPath, StatusBarColor, TableGridLines, TextFieldsEditable, TextFrameMarkerLines, UICulture, Width
Web.TextControlCulture, FormattingPrinter, ServiceAddress, ServicePort, UICultureResetContents

Document Editor JavaScript API

Next Steps