找回密码
 立即注册

QQ登录

只需一步,快速开始

sammer110
注册会员   /  发表于:2022-5-27 16:54  /   查看:1402  /  回复:3
50金币
设计器内预览正常:


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[0].DefaultValue.Values.Add(djbh);

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

            this.Close();

        }

附件: 您需要 登录 才可以下载或查看,没有帐号?立即注册

最佳答案

查看完整内容

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

3 个回复

倒序浏览
最佳答案
最佳答案
wengMQ悬赏达人认证
银牌会员   /  发表于:2022-5-27 16:54:42
来自 3#
把打印的代码移到LoadCompleted事件里面去
private void ARptView_LoadCompleted(object sender, EventArgs e)
        {
            
                    bool hasprint = ARptView.Print(false, true, false);
                    
        }

评分

参与人数 1金币 +660 收起 理由
KearneyKang + 660 很给力!

查看全部评分

回复 使用道具 举报
Bella.YuanWyn认证
超级版主   /  发表于:2022-5-27 18:01:04
2#
您好,您可以先使用winform自带的打印测试一下是否是正常,如果winform自带打印测试正常,那就是您代码阿编写存在问题,可以参考这个链接:
https://www.grapecity.com/active ... orts-developer.html
回复 使用道具 举报
Bella.YuanWyn认证
超级版主   /  发表于:2022-5-30 10:50:37
4#
wengMQ 发表于 2022-5-28 09:26
把打印的代码移到LoadCompleted事件里面去
private void ARptView_LoadCompleted(object sender, EventArg ...

感谢老铁帮忙回复
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部