Document Processing Examples
Documents that your code compares, imports, restyles or prints don't need an editor on the screen: the same work runs on the TextControl of a form or on a ServerTextControl, which has the same programming interface without a user interface. The samples and articles below show such tasks in Windows Forms projects, together with articles whose code works in any .NET product of TX Text Control.
Sample Projects
All projects are Windows Forms applications in C#, unless the table says Visual Basic. The version is the one the project references today; the code often dates from the year of the article.
| Example | What it shows | Where |
|---|---|---|
| Document comparison | Two documents compared word by word, with the differences marked as tracked changes, as described in Word-based Document Comparison and Track Changes Using TX Text Control and C#. .NET 8, version 33.0 | TXTextControl.Windows.Forms.Comparison |
| Excel import | A sheet of an XLSX file loaded as a table with LoadSettings.DocumentPartName, as described in Loading and Processing Excel XLSX Spreadsheet Tables into TX Text Control using .NET C#. .NET 8, version 33.0 | TXTextControl.Windows.Forms.Excel.Import |
| Styles from a master template | The ParagraphStyles and InlineStyles of a DOTX template copied into a DOCX document, as described in Applying and Updating Formatting Styles from Master Templates (DOTX) in DOCX Documents. .NET 8, version 33.0 | TXTextControl.Windows.Forms.MasterTemplate |
| Multipage TIFF | Each frame of a multipage TIFF image placed on a page of its own, as described in Inserting Multipage TIFF Images into TX Text Control. .NET Framework 4.0, version 33.0 | TextControl.MultipageTIFF |
| Images from memory | A System.Drawing.Image inserted without a file, as described in Inserting Images from Memory. Visual Basic, version 33.0 | TextControl.WindowsForms.ImagesFromMemory |
| Markdown with Markdig | Markdown converted to HTML with the Markdig library and loaded, as described in Loading Markdown Content into TX Text Control. Written before the package TXTextControl.Markdown.Core. .NET Framework 4.7.2, version 33.0 | TextControl.WindowsForms.Markdown |
| ServerTextControl diagnostics | A factory that counts the ServerTextControl instances of an application and the handles they use, and disposes them, as described in Diagnostics: When Calling ServerTextControl.Create() Failed. A class without a project | TXTextControl.Diagnostics.ServerTextControlFactory |
Document Editor Examples lists further samples that change a document in the editor, such as styles, tables of contents, watermarks and printing.
Blog Articles With Code
These articles contain their code in the article. Those marked Windows Forms use the TextControl of a form; the others use ServerTextControl, which is part of TX Text Control .NET for Windows Forms as well:
| Example | What it shows | Where |
|---|---|---|
| Text to table and back | Tab-separated text turned into a table, and a table into text. Windows Forms | Text to Table and Table to Text in TX Text Control and C# |
| Tables to tabs | An extension method that converts a table into tab-separated text. Windows Forms | Extension Method: Converting Tables to Tabs in C# |
| Bulleted lists from plain text | Lines of plain text turned into a bulleted list. Windows Forms | Convert Plain Text to Bulleted Lists in C# with .NET |
| Section breaks | All section breaks removed from a DOCX document. Windows Forms | How to Delete All Section Breaks in a DOCX Document using C# |
| Printing DOCX | A DOCX document printed with ServerTextControl.Print, without Microsoft Word | Print MS Word DOCX Documents in .NET using C# Without Interop |
| Comments | The comments of a DOCX document read with CommentedText | Extracting Comments from DOCX Files in .NET C# |
| SVG images of pages | The pages of a DOCX document saved as SVG images with Page.GetImage | Convert MS Word DOCX to SVG in .NET C# |
| Markdown | Markdown loaded and saved with the package TXTextControl.Markdown.Core | Introducing TXTextControl.Markdown.Core: Import and Export Markdown in TX Text Control |
Next Steps
- Document Processing: create, load, change and save documents in code.
- Mail Merge Examples: documents created from templates and data.
- GitHub Examples: run a sample and update it to the current version.