【问题标题】:Problem printing from ReportViewer control in ASP.NET web application从 ASP.NET Web 应用程序中的 ReportViewer 控件打印问题
【发布时间】:2010-10-08 13:26:50
【问题描述】:

我有一个使用 ASP.NET 中的 ReportViewer 控件的 Web 应用程序。报告在 Web 应用程序的 .rdlc 文件中定义。 除了打印功能外,报告工作得很好。当用户单击报告标题部分中的“打印”图标时,Web 应用程序似乎尝试安装 SQL Server (?!)。这是出现的文件下载对话框:

任何人都可以猜测发生了什么吗?我什至不确定从哪里开始调试,因为这一切都发生在 ReportViewer 代码中的“幕后”。

感谢您提供的任何建议。

【问题讨论】:

    标签: asp.net sql reportviewer report


    【解决方案1】:

    它尝试安装的不是 SQL Server,它是一个用于打印报告文件的 activex/插件,单击是,安装它并尝试打印。

    【讨论】:

    • 感谢您的回复。实际上,无论我做什么,安装,不安装,甚至只是在显示对话框时暂停片刻...它们都会使浏览器中的选项卡崩溃,网站消失,然后浏览器“恢复”一个空白标签。这是在 IE 中,它必须是我使用的浏览器(每个客户端)
    • 试试这个:转到 Program Files\Microsoft SQL Server\MSSQL.x\Reporting Services\ReportServer\bin,然后将这些文件复制到 Windows\Downloaded Program Files(使用命令窗口、cmd):- RSClientPrint.dll - rsclientprint.inf - RsClientPrint_1028.rll - RsClientPrint_1031.rll - RsClientPrint_1033.rll - RsClientPrint_1036.rll - RsClientPrint_1040.rll - RsClientPrint_1041.rll - RsClientPrint_1042.rll - RsClientPrint_2052.rll - RsClientPrint_3082 regsvr32 [路径]RSClientPrint.dll)。如果在那里找不到这些文件,请提取 rsclientprint.cab。
    • 感谢您跟进此事。我仍然得到一个错误...这一次,我选择安装 ActiveX 的东西。它有问题,问我是否要调试问题(使用调试器),我选择了否,它以与以前相同的方式使浏览器(选项卡)崩溃。我想我应该禁用报告上的打印。我的客户可能无法下载 ActiveX 控件以进行打印。谢谢您的帮助。我会告诉他们先导出到 excel(或 PDF),然后再打印。非常感谢您的指导。
    【解决方案2】:

    是的。在我尝试同样的问题之前。但在那之后我得到了解决方案。最主要的是,我们不能直接从客户端机器打印报告。我找到了两种在客户端机器上打印报告的方法。一种是通过ActiveX 控件。客户不知道如何在他们的机器上安装 ActiveX 控件,主要是他们不想要那些令人讨厌的东西。所以我找到了另一种可以通过 PDF 文件打印的方式。现在所有人都在他们的机器上安装了 adobe pdf 阅读器。所以我浏览了如何直接打印pdf而不保存在他们的客户端机器中。最后我得到了解决方案。步骤是:

    用 C# 编写的示例代码。

    我)。将报告转换为内存流:

    string reportType = "PDF";
        string mimeType;
        string encoding;
        string fileNameExtension;
        //The DeviceInfo settings should be changed based on the reportType
        ////http://msdn2.microsoft.com/en-us/library/ms155397.aspx 
    
        string deviceInfo = "<DeviceInfo>" + "  <OutputFormat>PDF</OutputFormat>" + "  <PageWidth>8.27in</PageWidth>" + "  <PageHeight>11.69in</PageHeight>" + "  <MarginTop>0in</MarginTop>" + "  <MarginLeft>0in</MarginLeft>" + "  <MarginRight>0in</MarginRight>" + "  <MarginBottom>0in</MarginBottom>" + "</DeviceInfo>";
        Warning[] warnings;
        string[] streams;
        byte[] renderedBytes;
        //Render the report       
        renderedBytes = _rptViewer.LocalReport.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);
        Stream mystream = new MemoryStream(renderedBytes);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多