首页 > 解决方案 > rldc 报告 Winforms 中的 PrintDialog() 错误

问题描述

嘿伙计们,我想知道为什么我在调用 rdlc reportviewer.PrintDialog() 时会出现故障

这是我的代码:来自另一种形式。

让我们称之为form1;那么reportviewer所在的form就是PrintForm;

表格1代码:

    //Populating Dataset to Reports
                var customer = new ReportDataSource("reportSingleCustomer", singleDS.Tables["singleCustomerDT"]);
                var order = new ReportDataSource("reportSingleOrder", singleDS.Tables["singleOrderDT"]);
                var payment = new ReportDataSource("reportSinglePayment", singleDS.Tables["singlePaymentDT"]);

                //Clearing ReportViewer From Sources
                pf.ReportViewer.Reset();
                pf.ReportViewer.Clear();

                //Populating ReportViewer
                pf.ReportViewer.LocalReport.ReportPath = "../../PrintFolder/SingleCustomer/singleReceipt.rdlc"; //Path in Solution Explorer through the Folder
                pf.ReportViewer.LocalReport.DataSources.Clear(); //Clearing Report Data;

                //Adding Report Sources to Report Viewer
                pf.ReportViewer.LocalReport.DataSources.Add(customer);
                pf.ReportViewer.LocalReport.DataSources.Add(order);
                pf.ReportViewer.LocalReport.DataSources.Add(payment);
                pf.ReportViewer.RefreshReport();

                //Setting Max Display of ReportViewer
                pf.ReportViewer.SetDisplayMode(DisplayMode.PrintLayout); //Fullscreen
                pf.ReportViewer.ZoomMode = ZoomMode.PageWidth; //Fullscreen width;
                pf.ReportViewer.ZoomMode = ZoomMode.FullPage; //FullPage in Fullscreen;
                pf.ReportViewer.ZoomMode = ZoomMode.Percent; //in 100% Zoom Print Area.
                PrintLoadingMainPanel.Visible = false;
                pf.ShowDialog(this);

现在在 PrintForm

ReportViewer.PrintDialog();

但是每当我在 printdialog 中单击打印或取消它时,就会发生奇怪的关闭故障,例如调用 .Dispose() 时发生的故障。rldc 中是否有这样的错误?我正在使用 RLDC VERSION Microsoft.ReportingServices.ReportViewerControl.Winforms.150.1449.0 我没有尝试过较低版本,因为我几个小时前才安装了这个。希望你们能帮助我。谢谢你。

标签: c#winformsprintingreportviewer

解决方案


推荐阅读