Back to Devexpress

Document Creation Approaches

windowsforms-3857-controls-and-libraries-printing-exporting-fundamental-concepts-document-creation-approaches.md

latest8.2 KB
Original Source

Document Creation Approaches

  • Jan 23, 2019
  • 2 minutes to read

This topic demonstrates how you can print and/or export a visual control or a non-visual component using printing links added to a Printing System collection.

This topic consists of the following sections.

To print standard Windows Forms controls, the XtraPrinting Library provides the following standard link types (all deriving from the base Link class).

For code samples, see How to: Print a TreeView Control and How to: Print a DataGrid Control.

The following DevExpress controls implement the IPrintable interface and can be printed using the PrintableComponentLink.

The following web controls implement the IPrintable interface and can be directly exported to a stream or response in various document formats using the methods of their corresponding exporter objects.

ASP.NET WebForms ControlExporter
ASPxGridViewASPxGridViewExporter
ASPxCardViewASPxCardViewExporter
ASPxVerticalGridASPxVerticalGridExporter
ASPxPivotGridASPxPivotGridExporter
ASPxTreeListASPxTreeListExporter
ASP.NET MVC ControlExporter
MVCxGridViewMVCxGridViewExporter
MVCxPivotGridMVCxPivotGridExporter
MVCxTreeListMVCxTreeListExporter
MVCxCardViewMVCxCardViewExporter
MVCxVerticalGridMVCxVerticalGridExporter

For more information, see How to: Use the PrintableComponentLink to Print DevExpress Controls.

To print your custom component using Printing System, this component should implement the IPrintable interface, after which you can print it using the PrintableComponentLink class.

For more information, see How to: Create a Printable ListView Descendant Implementing the IPrintable Interface.

Additional Customization

The Link class provides a set of events, each intended to create a specific document section.

In any of these event handlers, you can customize the CreateAreaEventArgs.Graph property, which provides access to a Brick Graphics object that is used to create bricks of different types.

Handle these events in the following order to create and/or modify your document sections.

After finishing modifying document sections, call the Link.CreateDocument method (to create a paginated document that is ready to be previewed, printed or exported) or the Link.ShowPreview method (which creates a document and then shows it in a Print Preview form).

For more information, see How to: Use Link Events (Complete Sample).

See Also

Printing System

Printing Links