TX Text Control .NET for Windows Forms

Document Editor Examples

Topic

These samples extend the editor of TX Text Control .NET for Windows Forms: styles and tables of contents, line numbers and watermarks, lists and tables, zooming, printing and data binding. Each is a small project on GitHub that shows one technique around the TextControl, with a blog article that explains it. The tables name the version and the framework each project references today; the code itself often dates from the year of the article.

Before You Run an Older Sample

Most of these samples are projects for the .NET Framework that reference the TX Text Control assemblies of your installation, and some reference an earlier version. Add the references again from the Assembly folder of your installation and update the version in licenses.licx, as GitHub Examples describes. All samples are in C# unless the table says Visual Basic.

Styles and Structure

ExampleWhat it showsWhere
Paragraphs to stylesParagraphs with the same formatting found and turned into paragraph styles, as described in Converting Paragraphs to Styles by Comparing Formatting Attributes. .NET Framework 4.8, version 33.0TXTextControl.Windows.Forms.Styles.Create
Table of contentsA table of contents created with the ribbon or in code, as described in Create a Table of Contents in Windows Forms using C#. .NET Framework 4.8, version 31.0TextControl.WindowsForms.createTOC
Table of contents without stylesFormatted headings turned into styles, so that a table of contents can be inserted, as described in Creating Table of Contents without Stylesheets. .NET Framework 4.8, version 33.0TextControl.WindowsForms.TOCStyles
Restart numbered listsTwo ways to restart the numbering of a list, as described in Two Ways to Restart Numbered Lists in TX Text Control. Version 33.0TextControl.Windows.Forms.RestartNumbering

Styles copied from a DOTX master template into a DOCX document are shown in Document Processing Examples.

Decorations on the Page

ExampleWhat it showsWhere
Legal line numberingLine numbers combined with form fields and document protection, as described in Legal Documents: Combining Line Numbering, Form Fields and Document Protection. .NET Framework 4.8, version 33.0TXTextControl.Windows.Forms.LineNumbering
Line numbers in the marginLine numbers drawn next to the text at positions from DocumentToClient, as described in Displaying Line Numbers in Windows Forms and WPF. .NET Framework 4.5, version 34.0TextControl.WindowsForms.LineNumbering
WatermarksA watermark image centered on every page and added again when the document changes, as described in Inserting Watermark Images to All Pages Dynamically. .NET Framework 4.5, version 34.0TextControl.Watermarks
Tab stop guidesVertical guides at the tab positions of the current paragraph. .NET Framework 4.8, version 31.0TextControl.WindowsForms.TabStopGuides

Editing and Viewing

ExampleWhat it showsWhere
Format painterFormatting copied from one selection to another through a context menu, as described in TX Text Control Format Painter Sample Released. .NET Framework 4.8, version 33.0TextControl.WindowsForms.FormatPainter
Smart selectionsA double-click that selects whole URLs, decimal numbers and email addresses, as described in Sample: Custom Smart Selections with TX Text Control .NET. .NET Framework 4.0, version 33.0TextControl.CustomSmartSelections
Fit to page and fit to widthA ZoomFactor calculated from the page size, as described in 'Fit to Page' and 'Fit to Width' Using TX Text Control .NET. .NET Framework 4.0, version 33.0TextControl.FitToPage-FitToWidth
Margins in the FloatingText viewMargins around the text when the ViewMode is FloatingText, as described in Windows Forms: Adding Margins to FloatingText ViewMode. .NET Framework 4.8, version 33.0TXTextControl.Windows.Forms.CustomMargin
Page limitA document limited to a maximum number of pages. Visual Basic, version 33.0TXTextControl.Windows.Forms.tx_page_limit
Documents from a web serverA document opened from a link on a web page in a Windows Forms editor, through a URI protocol registered for the client application, and saved back to the server, as described in Windows Forms: Loading and Saving Documents from a Server. .NET Framework 4.0, version 31.0TextControl.LoadSaveDocumentsFromServer
Several pages per sheetA PrintDocument that prints several page images on one sheet, as described in Windows Forms: Printing Multiple Pages Per Sheet. .NET Framework 4.5, version 33.0TextControl.MultipagePrintDocument

Tables and Fields

ExampleWhat it showsWhere
AutoFit for tablesColumn widths fitted to the content of the cells, as described in Building a Table AutoFit. Visual Basic, .NET Framework 4.5, version 33.0TextControl.WindowsForms.AutoFit
AutoSize for tablesAn extension method of Table that sets the width of each column from the longest line of text in its cells, as described in Extending the Table Object: AutoSize. .NET Framework 4.0, version 32.0TextControl.TableAutoFit
Table indentA table aligned to the indent of the paragraph, as described in Table Indent Alignment Sample Available. .NET Framework 4.5, version 32.0TextControl.WindowsForms.TableIndentAlignment
Check box fieldsCheck box fields compatible with MS Word, as described in Inserting MS Word Compatible FORMCHECKBOX Fields. .NET Framework 4.8, version 33.0TextControl.WindowsForms.FormCheckBoxFields
Data bindingA TextControl with an RTF property bound to a BindingSource, like a RichTextBox, as described in RichTextBox Compatible Data Binding with TX Text Control. .NET Framework 4.5, version 33.0TextControl.WindowsForms.PropertyBinding

Official Samples

The how-to samples of TXSamples_WinForms_CSharp show hypertext links in three steps, formulas compatible with Excel in the cells of a table, charts and XML files, written for version 32.0. The TX Words samples show context menus, keyboard shortcuts, drag and drop, hyperlinks and editable regions for each user; see TX Words Sample Application.

Next Steps