Hi everyone, by means of introduction my name is Martin Vassilev and I am a support officer with the Windows Forms team here at Telerik. As of late, we noticed increased interest towards RadGridView data export capabilities.
What we have always told our customers is that the RadGridView will have only basic Microsoft Excel export capability, until we are able to implement a commercial grade format converter here at Telerik. However, that requires quite some time, and customers can’t wait right? What was needed was a quick, easy, stable way of exporting RadGridView content to formats such as RTF, PDF and XLS. We also wanted to leverage an existing technology, rather than start from scratch. Well - guess what: the answer turned out to be right next door (quite literally too) – Telerik Reporting.
For one, it already offers all the exporting capabilities we need, and also delivers a fine-grained and professional printing mechanism, with print preview capability and numerous adjustments options.
We have prepared a classhelper library that can be used to interface the RadGridView component with Telerik Reporting. Using the helpers allows the generation of flat (no hierarchy support at this moment) grids with or without grouping into a report that can easily be printed or exported to a number of formats.
What’s really neat is that when you create reports from RadGridView, most of its visual settings such as column widths, header colors, text alignments and font formatting are transferred to the report.
So, how do you use the RadGridReporting class and start creating your own reports based on RadGridView? Just add a copy of RadGridReportinLite.dll and add a reference to it in your project. To benefit from this functionality , you need to have installed both Telerik RadControls for Windows Forms and Telerik Reporting products. After that, you will be able to create an instance of ReportForm and set various options such as:
Fit column sizes to printing page
Use grid header colors(mixed from gradients)
Set all page margins in milimeters
Choose report paper kind format (A4, A3 etc.)
Choose lanscape or portrait view
Choose to repeate table header on every page
Windows state of report form
Size of report form (if not maximized)
To generate the report, you need to call the ReportFormShow method and pass your RadGridView instance as a second parameter.
I have prepared a small Example application to illustrate the approach. It is available in our code library section.
Nikolay Diyanov Diyanov is the Product Manager of the Native Mobile UI division at Progress. Delivering outstanding solutions that make developers' lives easier is his passion and the biggest reward in his work. In his spare time, Nikolay enjoys travelling around the world, hiking, sun-bathing and kite-surfing.
Find him on Twitter @n_diyanov or on LinkedIn.
Copyright © 2016, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.