- Devexpress Printablecomponentlink Add Header
- Devexpress Printablecomponentlink Fit To Page
- Devexpress Printablecomponentlink Component
- Devexpress Printablecomponentlink
- 3 minutes to read
I am currently programming within Visual Studio 2010 using VB.Net and DevExpress V10.2 Winforms. I currently have a DevExpress GridControl that contains two DevExpress GridViews. So there is the main view and the subgrid (similar to the DevExpress demo for Master-Detail Grids - example with WinForms and better view with ASPxGridView ). If you use printing system links to print or export data from a view, you should set the view's OptionsPrint.ShowPrintExportProgress property to false. Additionally, if the server mode is used, it is necessary to call the BaseView.ClearDocument method before printing. GridView - NullReferenceException is thrown when a document is created using PrintableComponentLink. NullReferenceException is thrown on exporting RepositoryItemCheckEdit with CheckStyle set to UserDefined if corresponding check images are not set. NullReferenceException occurs when the 'Clear Filter' menu item is clicked in AutoFilterRow.
This tutorial illustrates how to use the PrintableComponentLink to print DevExpress Windows Forms controls at runtime. For a design-time approach, refer to the How to: Preview, Export and Print a Windows Forms Control topic.
To get started with this tutorial, create a Windows Forms Application with a print preview, similar to the one created in the following tutorial: How to: Add a Print Preview to a Windows Forms Application.
This tutorial consists of the following sections.
Add a Grid Control
Devexpress Printablecomponentlink Add Header
- Add a new page ('Grid') to the Ribbon toolbar using the Ribbon Control Designer. To learn how to manage ribbon items, see the Ribbon Items Page topic.
To add a grid to the main form, press CTRL+ALT+X to open the Toolbox. Next, drag the GridControl control from the DX.20.2: Data & Analytics category and drop it on the form.
- Bind the grid control to data. To learn how to bind the grid control to data sources of different types, see the Examples: Data Binding topic.
Psp controls. To use the Ribbon control's pages to quickly switch between the grid and print preview, handle the RibbonControl.SelectedPageChanged event, and add the following code to the event handler.
If you use printing system links to print or export data from a view, you should set the view's OptionsPrint.ShowPrintExportProgress property to false. Additionally, if the server mode is used, it is necessary to call the BaseView.ClearDocument method before printing or exporting data.
Devexpress Printablecomponentlink Fit To Page
Create a Printing Link
The following code demonstrates how to create a PrintableComponentLink, add it to the PrintingSystem.Links collection, adjust its printing settings, and use it to print an existing GridControl.
Devexpress Printablecomponentlink Component
Publish the Document
A Windows Forms application with a print preview is now ready. You can change the GridControl layout by applying grouping, filtering or sorting.
To preview the document, click the Print Preview tab on the Ribbon. Use the menu options in this tab to print and/or export the document to one of the available formats.