Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to load rpt file to ReportDocument object for direct printing without viewing rpt file in CrystalReportsViewer.

I have tried the following code but I am getting error "LOAD REPORT FAILED". Kindly help me. Thanks


What I have tried:

PrintDialog printDialog1 = new PrintDialog();
ReportDocument report = new ReportDocument();

if (printDialog1.ShowDialog() == true)
{
       report.PrintOptions.PrinterName = printDialog1.PrintQueue.Name;
       report.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)System.Drawing.Printing.PaperKind.Legal;
       report.Load("invoice.rpt");
       report.PrintToPrinter(2, false, 0, 0);
       myview.view.ViewerCore.ReportSource = report;
       myview.view.ToggleSidePanel = SAPBusinessObjects.WPF.Viewer.Constants.SidePanelKind.None;
}
Posted
Comments
Richard Deeming 17-Jul-18 11:12am    
Try specifying the full path of the report file, and checking that the report file exists in that path.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900