Home / Community & Support / Knowledge Base / RadControls for WinForms / GridView / Printing RadGridView via Telerik Reporting

Printing RadGridView via Telerik Reporting

Article Info

Rating: 3

Article information

Article relates to

 Printing RadGridView via Telerik Reporting

Created by

 Martin Vasilev

Last modified

 05/10/2008

Last modified by

 Martin Vasilev


HOW-TO

Generate a report based on RadGridView, and using the export capabilities of Telerik Reporting.

DESCRIPTION

In this code library article could be found a simple class that allows to easily export a single-level hierarchy RadGridView in a Telerik Reporting report.  This report can then be printed or exported in a variety of formats.
You can use the properties below to control the appearance of the report.

Int AllMargins – Set all paper margins in millimeters
Int BottomMargin – Set bottom margin in millimeters
Int TopMargin – Set top margin in millimeters
Int LeftMargin – Set left margin in millimeters
Int RightMargin – Set right margin in millimeters
bool FitToPageSize – Controls whether report table is fit to page size
bool PageLandScape – Controls orientation of the report on the page
PaperKind PaperKind – Set paper type (A4, A3 etc.)
bool RepeatTableHeader – Controls whether the table header is repeated on each page
string ReportName – Set report name
size ReportSize – Set report size
FormWindowState ReportWindowState – Set report form window state
bool UseGridColors – Controls whether the report uses the header colors from RadGridView


RadGridReport(string reportName) – Create a new instance of the class

ReportFormShow(IWin32Window owner, RadGridView radGridView) - generate and show the report.

SOLUTION

  1. Add a reference to RadGridReportingLite.dll in your project (the library project could be find in this article).
  2. Create an instance of RadGridReport:
    RadGridReportingLite.RadGridReport report = new RadGridReportingLite.RadGridReport("MyGridReport");
  3. Set properties controlling format and appearance:
    report.AllMargins = 1;  
    report.FitToPageSize = true;  
    report.RepeatTableHeader = true
  4. Generate and show the report using the code below:
    report.ReportFormShow(this, this.radGridView1);

Comments

  • Eric Schoenholzer , Jul 1, 2008

    And for a Web Application? Possible too?

  • Telerik Admin , Jul 16, 2008

    Our Web RadGrid control supports various export formats and you do not need to do this. If you want to print only the grid, add a button which opens the RadGrid only on a separate "print" page.

If you'd like to comment on this KB article, please, send us a Support Ticket.
Thank you!

Please Sign In to rate this article.