TX Text Control .NET for WPF

Document Processing

Topic

Not every document in a WPF application is typed by its user. Reports are assembled from data, files arrive in one format and must leave in another, and letters go to the printer without being opened. Three short tutorials handle these jobs with button handlers in the window of your first application, using ServerTextControl, the document engine without a user interface, next to the TextControl in XAML.

Choose a Tutorial

TutorialYou learn toMain members
Create a Document ProgrammaticallyBuild a report with formatted text, a table, an image and a header, save it as DOCX and show it in the editorServerTextControl, Selection, Tables, Images, HeadersAndFooters
Save as DOCX and PDFExport the editor's document and convert Word files in the backgroundSave, StreamType, ServerTextControl
Print a DocumentPrint with the print dialog and without one, print files with ServerTextControl and set the formatting printerPrint, PageRange, PrintDocument, FormattingPrinter

Before You Start

Each tutorial can be followed on its own. In the order of the table, they go from creating a document to saving it and printing it.

Where WPF Differs

ServerTextControl, Selection, SaveSettings and the other classes that build and save documents are shared with TX Text Control .NET for Windows Forms, and code that uses them looks the same in both. The differences are in the window around it:

  • Buttons and handlers are declared in XAML, and a Click handler receives RoutedEventArgs.
  • Dialogs come from WPF: Microsoft.Win32.OpenFileDialog for files and the print dialog of WPF for printing.
  • Printing from the editor uses the print system of WPF, with a printer name, a PageRange and a copy count. Printing with ServerTextControl uses a PrintDocument, which a .NET WPF project gets from the NuGet package System.Drawing.Common.

After These Tutorials

  • Mail Merge: fill templates with data instead of building each document in code.
  • PDF Processing: PDF options, PDF forms and digital signatures.
  • Document Processing: creating, loading, converting and printing documents in detail.