如何在WPF C#中将RPT文件加载到ReportDocument对象

时间:2018-07-16 07:04:16

标签: c# wpf

我尝试了以下代码,但出现错误“ LOAD REPORT FAILED”。 请帮助我。 谢谢

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;
}

我正在尝试将rpt文件加载到ReportDocument对象以进行直接打印,而无需在CrystalReportsViewer中查看rpt文件。

0 个答案:

没有答案