Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Collapse]Build an Application
  [Expand]Choose Application UI
   Data Management Controls
  [Collapse]Printing and Exporting
    How to: Preview XtraGrid Control
    How to: Customize Print Appearances
    How to: Set Paper Format and Add Custom Information to the Report when Printing/Exporting a Control
    Printing Basics
    Printing Options
    Print Appearances
    Export a Control in Various Formats (PDF, HTML, BMP, etc.) Using the XtraPrinting Library
  [Expand]WinForms MVVM
  [Expand]Skins
  [Expand]Localization
  [Expand]Right-to-Left Layout
   Redistribution and Deployment
 [Expand]Controls and Libraries
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Export a Control in Various Formats (PDF, HTML, BMP, etc.) Using the XtraPrinting Library

The XtraPrinting Library allows you to export DevExpress .NET controls in various formats - PDF, HTML (plus MHT), TXT (plus CSV), XLS, RTF, as well as BMP, JPEG, GIF, TIFF, PNG, EMF. This topic demonstrates how an end-user can export controls in a PDF format using the Print Preview window and how to export controls via code.

Note

Note that certain controls cannot be exported in some formats using XtraPrinting Library. All controls, however, can be exported as a PDF or an image format.

Expanded Export Using the Print Preview Window

A control that can be printed using the XtraPrinting Library can be quickly exported in one of the available formats via the Print Preview window.

The Print Preview window can be displayed using the control's ShowPrintPreview method. The following image demonstrates the Print Preview window for a sample Grid Control.

The toolbar located at the top of the form contains the Export Document... button. Clicking on it displays a drop-down menu that allows you to choose the format with which to save the report.

Click on the required option in the drop-down menu to export the control to the required format.

To add page or report headers to the report, generate a report using printable link. This approach is described in the How to: Set Paper Format and Add Custom Information to the Report when Printing/Exporting a Control topic.

Expanded Export in Code

The following code demonstrates how to export a control to a PDF file using XtraPrinting Library methods without activating the Print Preview window. The control (XtraGrid) will be exported in as a PDF using the PrintingSystemBase.ExportToPdf method. For more information on printing and exporting controls, refer to the XtraPrinting Library documentation.

Expanded See Also

How would you rate this topic?​​​​​​​