none
Sending a report from reportviewer to a pcl file RRS feed

  • Question

  • I'm trying to find a way to automate writing a Microsoft report to a .pcl file. Currently the user can click the print button to open the print dialog box, select print to file, then enter the file name. I would like to find a way to do this silently so that each time the user generates a report a pcl file is generated. The only information I've been able to find involved writing to a pcl file line by line, not a complete report. I've experimented with using ReportViewer.LocalReport.Render but that only gives me the pdf, excel and image file options. The only solution I've found so far is to do it with a combination of SendKeys once the report is generated but it's ugly, so I was hoping someone knew of a better way. Any suggestions will be appreciated, thanks.
    Wednesday, December 10, 2008 7:31 PM

Answers

  • I believe you can achieve this by rendering the report to EMF and then using a PrintDocument to print the report. Before you call the Print method on the PrintDocument you need to make sure you set the PrintToFile option on the PrinterSettings property. There is an example at http://www.gotreportviewer.com that shows to you how to print a report in a console app using EMF, that should get you most of what you need.


    This posting is provided "AS IS" with no warranties, and confers no rights.


    Thursday, December 11, 2008 2:48 PM

All replies

  • I believe you can achieve this by rendering the report to EMF and then using a PrintDocument to print the report. Before you call the Print method on the PrintDocument you need to make sure you set the PrintToFile option on the PrinterSettings property. There is an example at http://www.gotreportviewer.com that shows to you how to print a report in a console app using EMF, that should get you most of what you need.


    This posting is provided "AS IS" with no warranties, and confers no rights.


    Thursday, December 11, 2008 2:48 PM
  • Thanks, I'll check this out. I had tried a solution similar to this but the pcl files I was generating were garbled. I must not have been reading the EMF into the pcl file correctly.
    Friday, December 12, 2008 1:20 PM