Back to Devexpress

Printing

expressappframework-113012-shape-export-print-data-printing-exporting-in-list-view-printing.md

latest4.7 KB
Original Source

Printing

  • Apr 10, 2025
  • 3 minutes to read

The printing system allows you to print Views. This topic describes the basics of using this WinForms-specific system.

The printing system contains the PrintingController View Controller. It is activated for Detail Views and List Views. All the functionalities it represents are in the following Actions.

  • Page Setup…

  • Print Preview…

  • Print…

All the Actions are added to the Print Action Container, which displays them as an item group in the File main menu.

The PrintPreview Action is also available in nested List Views.

The options specified in the “Page Setup” dialog and the ‘Header and Footer’ options, which are set in the Preview dialog, are saved automatically. The IModelPrintingSettings node is added to the Application Model, and filled with values each time printing settings are changed via the PageSetup or PrintPreview Actions for a View. These options can be saved separately for each View, or they can be saved to the IModelOptions to affect all Views in an application. By default, the options set for a View affect all Views. You can change this behavior via the application project designer:

The PrintingController exposes two useful public events:

The XAF printing system actually uses the XtraPrinting library to print and preview XAF Views. XtraPrinting enables printing for the controls that implement the IPrintable interface. So, if a View in an XAF application is represented by a control that supports the IPrintable interface, this View can be printed, and the printing’s Actions are enabled for this View. A Detail View’s control is a Layout Control, which is printable. So, Detail Views can be printed. List Views are represented by the controls specified by List Editors. All Windows Forms built-in List Editors support the IExportable interface, which in its turn returns a printable control via the IExportable.Printable property. So, all List Views can be printed as well. If you use a custom List Editor to display List Views, and you want its data to be printable, implement the IExportable interface in it, and the DevExpress.XtraPrinting.IPrintable interface in the control it uses. To learn how to implement the IPrintable interface in a standard control, refer to the How to: Create a Printable ListView Descendant Implementing the IPrintable Interface topic.

The printing system is demonstrated in the Feature Center Demo installed with XAF.

See Also

How to: Customize Export Options of the Printing System