# Document Editor Examples

> Samples of the Windows Forms TextControl as an editor: styles, tables of contents, line numbers, watermarks, lists, tables, zooming, printing and data binding.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control .NET for Windows Forms > Examples > Document Editor Examples
- **2151 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/examples/document-editor/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/examples/document-editor/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/examples/document-editor/llms-full.txt

---

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](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/llms-full.txt), 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](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/examples/github/#update-an-older-sample) describes. All samples are in C# unless the table says Visual Basic.

### Styles and Structure

| Example | What it shows | Where |
|---|---|---|
| Paragraphs to styles | Paragraphs with the same formatting found and turned into paragraph styles, as described in [Converting Paragraphs to Styles by Comparing Formatting Attributes](https://www.textcontrol.com/blog/2023/10/26/converting-paragraphs-to-styles-by-comparing-formatting-attributes/). .NET Framework 4.8, version 33.0 | [TXTextControl.Windows.Forms.Styles.Create](https://github.com/TextControl/TXTextControl.Windows.Forms.Styles.Create) |
| Table of contents | A table of contents created with the ribbon or in code, as described in [Create a Table of Contents in Windows Forms using C#](https://www.textcontrol.com/blog/2023/01/23/create-toc-in-windows-forms/). .NET Framework 4.8, version 31.0 | [TextControl.WindowsForms.createTOC](https://github.com/TextControl/TextControl.WindowsForms.createTOC) |
| Table of contents without styles | Formatted headings turned into styles, so that a table of contents can be inserted, as described in [Creating Table of Contents without Stylesheets](https://www.textcontrol.com/blog/2020/12/15/creating-table-of-contents-without-stylesheets/). .NET Framework 4.8, version 33.0 | [TextControl.WindowsForms.TOCStyles](https://github.com/TextControl/TextControl.WindowsForms.TOCStyles) |
| Restart numbered lists | Two ways to restart the numbering of a list, as described in [Two Ways to Restart Numbered Lists in TX Text Control](https://www.textcontrol.com/blog/2021/11/03/two-ways-to-restart-numbered-lists/). Version 33.0 | [TextControl.Windows.Forms.RestartNumbering](https://github.com/TextControl/TextControl.Windows.Forms.RestartNumbering) |

Styles copied from a DOTX master template into a DOCX document are shown in [Document Processing Examples](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/examples/document-processing/#sample-projects).

### Decorations on the Page

| Example | What it shows | Where |
|---|---|---|
| Legal line numbering | Line numbers combined with form fields and document protection, as described in [Legal Documents: Combining Line Numbering, Form Fields and Document Protection](https://www.textcontrol.com/blog/2022/03/18/legal-documents-combine-line-numbering-form-fields-and-document-protection/). .NET Framework 4.8, version 33.0 | [TXTextControl.Windows.Forms.LineNumbering](https://github.com/TextControl/TXTextControl.Windows.Forms.LineNumbering) |
| Line numbers in the margin | Line numbers drawn next to the text at positions from [DocumentToClient](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/documenttoclient-method/llms-full.txt), as described in [Displaying Line Numbers in Windows Forms and WPF](https://www.textcontrol.com/blog/2018/08/17/displaying-line-numbers-in-windows-forms-and-wpf/). .NET Framework 4.5, version 34.0 | [TextControl.WindowsForms.LineNumbering](https://github.com/TextControl/TextControl.WindowsForms.LineNumbering) |
| Watermarks | A watermark image centered on every page and added again when the document changes, as described in [Inserting Watermark Images to All Pages Dynamically](https://www.textcontrol.com/blog/2015/07/17/inserting-watermark-images-to-all-pages-dynamically/). .NET Framework 4.5, version 34.0 | [TextControl.Watermarks](https://github.com/TextControl/TextControl.Watermarks) |
| Tab stop guides | Vertical guides at the tab positions of the current paragraph. .NET Framework 4.8, version 31.0 | [TextControl.WindowsForms.TabStopGuides](https://github.com/TextControl/TextControl.WindowsForms.TabStopGuides) |

### Editing and Viewing

| Example | What it shows | Where |
|---|---|---|
| Format painter | Formatting copied from one selection to another through a context menu, as described in [TX Text Control Format Painter Sample Released](https://www.textcontrol.com/blog/2008/11/26/tx-text-control-format-painter-sample-released/). .NET Framework 4.8, version 33.0 | [TextControl.WindowsForms.FormatPainter](https://github.com/TextControl/TextControl.WindowsForms.FormatPainter) |
| Smart selections | A double-click that selects whole URLs, decimal numbers and email addresses, as described in [Sample: Custom Smart Selections with TX Text Control .NET](https://www.textcontrol.com/blog/2012/01/26/sample-custom-smart-selections-with-tx-text-control-net/). .NET Framework 4.0, version 33.0 | [TextControl.CustomSmartSelections](https://github.com/TextControl/TextControl.CustomSmartSelections) |
| Fit to page and fit to width | A [ZoomFactor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/zoomfactor-property/llms-full.txt) calculated from the page size, as described in ['Fit to Page' and 'Fit to Width' Using TX Text Control .NET](https://www.textcontrol.com/blog/2012/07/25/fit-to-page-and-fit-to-width-using-tx-text-control-net/). .NET Framework 4.0, version 33.0 | [TextControl.FitToPage-FitToWidth](https://github.com/TextControl/TextControl.FitToPage-FitToWidth) |
| Margins in the FloatingText view | Margins around the text when the [ViewMode](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/viewmode-property/llms-full.txt) is `FloatingText`, as described in [Windows Forms: Adding Margins to FloatingText ViewMode](https://www.textcontrol.com/blog/2022/06/14/windows-forms-adding-a-margin-to-floatingtext-viewmode/). .NET Framework 4.8, version 33.0 | [TXTextControl.Windows.Forms.CustomMargin](https://github.com/TextControl/TXTextControl.Windows.Forms.CustomMargin) |
| Page limit | A document limited to a maximum number of pages. Visual Basic, version 33.0 | [TXTextControl.Windows.Forms.tx\_page\_limit](https://github.com/TextControl/TXTextControl.Windows.Forms.tx_page_limit) |
| Documents from a web server | A 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](https://www.textcontrol.com/blog/2013/06/17/windows-forms-loading-and-saving-documents-from-a-server/). .NET Framework 4.0, version 31.0 | [TextControl.LoadSaveDocumentsFromServer](https://github.com/TextControl/TextControl.LoadSaveDocumentsFromServer) |
| Several pages per sheet | A `PrintDocument` that prints several page images on one sheet, as described in [Windows Forms: Printing Multiple Pages Per Sheet](https://www.textcontrol.com/blog/2015/07/24/windows-forms-printing-multiple-pages-per-sheet/). .NET Framework 4.5, version 33.0 | [TextControl.MultipagePrintDocument](https://github.com/TextControl/TextControl.MultipagePrintDocument) |

### Tables and Fields

| Example | What it shows | Where |
|---|---|---|
| AutoFit for tables | Column widths fitted to the content of the cells, as described in [Building a Table AutoFit](https://www.textcontrol.com/blog/2005/06/21/building-a-table-autofit/). Visual Basic, .NET Framework 4.5, version 33.0 | [TextControl.WindowsForms.AutoFit](https://github.com/TextControl/TextControl.WindowsForms.AutoFit) |
| AutoSize for tables | An 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](https://www.textcontrol.com/blog/2014/05/08/extending-the-table-object-autosize/). .NET Framework 4.0, version 32.0 | [TextControl.TableAutoFit](https://github.com/TextControl/TextControl.TableAutoFit) |
| Table indent | A table aligned to the indent of the paragraph, as described in [Table Indent Alignment Sample Available](https://www.textcontrol.com/blog/2009/02/26/table-indent-alignment-sample-available/). .NET Framework 4.5, version 32.0 | [TextControl.WindowsForms.TableIndentAlignment](https://github.com/TextControl/TextControl.WindowsForms.TableIndentAlignment) |
| Check box fields | Check box fields compatible with MS Word, as described in [Inserting MS Word Compatible FORMCHECKBOX Fields](https://www.textcontrol.com/blog/2010/01/27/inserting-ms-word-compatible-formcheckbox-fields/). .NET Framework 4.8, version 33.0 | [TextControl.WindowsForms.FormCheckBoxFields](https://github.com/TextControl/TextControl.WindowsForms.FormCheckBoxFields) |
| Data binding | A `TextControl` with an RTF property bound to a `BindingSource`, like a `RichTextBox`, as described in [RichTextBox Compatible Data Binding with TX Text Control](https://www.textcontrol.com/blog/2015/01/05/richtextbox-compatible-data-binding-with-tx-text-control/). .NET Framework 4.5, version 33.0 | [TextControl.WindowsForms.PropertyBinding](https://github.com/TextControl/TextControl.WindowsForms.PropertyBinding) |

### Official Samples

The how-to samples of [TXSamples\_WinForms\_CSharp](https://github.com/TextControl/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](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/examples/tx-words/llms-full.txt).

### Next Steps

- [Ribbon and Sidebar Examples](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/examples/ribbon-sidebar/llms-full.txt): samples of the ribbon, the sidebars and the toolbars.
- [Document Processing Examples](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/examples/document-processing/llms-full.txt): documents created and changed in code.
- [GitHub Examples](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/examples/github/llms-full.txt): run a sample and update it to the current version.

---

## Nearby

- **Previous:** [GitHub Examples](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/examples/github/llms-full.txt)
- **Next:** [Ribbon and Sidebar Examples](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/examples/ribbon-sidebar/llms-full.txt)
