Document Creation Approaches
- 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.
- Print Standard Windows Forms Controls
- Print DevExpress Controls for WinForms
- Print Custom Components
- Additional Customization
Print Standard Windows Forms Controls
To print standard Windows Forms controls, the XtraPrinting Library provides the following standard link types (all deriving from the base Link class).
- ListViewLink - a link to print the ListView control.
- RichTextBoxLink - a link to print the RichTextBox control.
- TreeViewLink - a link to print the TreeView control.
- DataGridLink - a link to print the DataGrid control.
For code samples, see How to: Print a TreeView Control and How to: Print a DataGrid Control.
Print DevExpress Controls
The following DevExpress controls implement the IPrintable interface and can be printed using the PrintableComponentLink.
- VGridControl and PropertyGridControl
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.
For more information, see How to: Use the PrintableComponentLink to Print DevExpress Controls.
Print Custom Components
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.
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).