Print RDLC file without showing print preview from Form button click

printingrdlcreportviewer

I've got a C#4.0 WinForm with a button click for Printing. In the Form Load event, I populate a custom object and stick that object into a list of that object. The object maps directly to the RDLC as a datasource and if I use the Report Viewer, I can see my RDLC file populated correctly. I found a link at MSDN to do this (http://msdn.microsoft.com/en-us/library/ms252091.aspx), but it blows up on the Export method.

Does anyone know of any good examples of how to print an RDLC file without using ReportViewer to preview the file? I just want to hit a button and have my List bind to the RDLC file (which I've already got working) and print directly to the printer.

any ideas?

Best Answer

Okay, so the link at Walkthrough: Printing a Local Report without Preview does actually work perfectly for my need to print a RDLC file without popping up the Print dialogue box. The mistake I made was naming my ReportDataSource. As in the example, MSDN names its ReportDataSource as "Sales" which matches the name of the DataSet in the RDLC XML codebehind. I had made the mistake of naming my ReportDataSource "Sale" which was causing the two not to be in sync and not print.

Problem solved!

Related Topic