sammer110 发表于 2022-5-27 16:54:41

ActiveReports V16.1.1.0 预览正常 winform调用打印报错

设计器内预览正常:


WinForm内打印报错:


WinForm内调用代码:
private void PrintViewer_Load(object sender, EventArgs e)
      {
            string file_name = Application.StartupPath + "\\Reports\\pfxhd.rdlx";

            GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(file_name));

            GrapeCity.ActiveReports.Document.PageDocument pageDocument = new GrapeCity.ActiveReports.Document.PageDocument(pageReport);

            //传入 XPU47621101100002
            pageReport.Report.ReportParameters.DefaultValue.Values.Add(djbh);

            //打印一次
            pageDocument.Print(false, true, false);

            this.Close();

      }

wengMQ 发表于 2022-5-27 16:54:42

把打印的代码移到LoadCompleted事件里面去
private void ARptView_LoadCompleted(object sender, EventArgs e)
      {
            
                  bool hasprint = ARptView.Print(false, true, false);
                  
      }

Bella.Yuan 发表于 2022-5-27 18:01:04

您好,您可以先使用winform自带的打印测试一下是否是正常,如果winform自带打印测试正常,那就是您代码阿编写存在问题,可以参考这个链接:
https://www.grapecity.com/activereportsnet/docs/latest/online/print-methods-in-activereports-developer.html

Bella.Yuan 发表于 2022-5-30 10:50:37

wengMQ 发表于 2022-5-28 09:26
把打印的代码移到LoadCompleted事件里面去
private void ARptView_LoadCompleted(object sender, EventArg ...

感谢老铁帮忙回复:hjyzw:
页: [1]
查看完整版本: ActiveReports V16.1.1.0 预览正常 winform调用打印报错