【问题标题】:VS2008 CR report viewer. Print and Export to PDF is not workingVS2008 CR 报表查看器。打印和导出为 PDF 不起作用
【发布时间】:2011-02-01 17:10:24
【问题描述】:

我在 VS2008 中有一个 Web 项目。问题是来自网络报告查看器;报告未打印或导出为 pdf。报告显示正常,但是当按下打印按钮或导出按钮时,没有任何反应。没有错误或崩溃。只是什么都没发生。默认打印机设置好了,我可以从那台机器上打印。我在这里错过了什么吗???

早些时候,当我将应用程序安装在新的虚拟目录中时,报告没有显示,然后我将 aspnet_Client 文件夹复制到新创建的 Web 应用程序根目录中,然后使报告可见。但是打印和导出功能不起作用。

【问题讨论】:

    标签: asp.net .net-3.5 crystal-reports


    【解决方案1】:

    您是否维护报告文档本身的状态?我必须将我的报告添加到 Session 并在页面加载时重置报告源。

        ReportDocument report = new ReportDocument();
            report.Load(Server.MapPath("blargh.rpt"));
            //...
            rptViewer.ReportSource = report;
    

    Session[Constants.Session.Report] = 报告;

    protected void Page_Load(object sender, EventArgs e)
        {//detects wether or not the RepoerViewer should be displayed again, to avoid it displaying an empty modal box.
            if (hdfDisplayCrystalReport.Value == "Yes")
            {
    
                rptViewer.ReportSource = (ReportDocument)Session[Constants.Session.Report];
    
            }
    
    
            if (rptViewer.ReportSource == null)
            {
                hdfDisplayCrystalReport.Value = string.Empty;
    
            }
    

    }

    【讨论】:

    • 这里有什么程序集值得这个类 Constants.Session.Report.
    【解决方案2】:

    您是否在 UpdatePanel 中使用报告?如果是这样,请检查是否已将触发器放置在面板内:

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
       <ContentTemplate>
          <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server"
              DisplayGroupTree="False" oninit="CrystalReportViewer1_Init" />
       </ContentTemplate>
       <Triggers> 
          <asp:PostBackTrigger ControlID="CrystalReportViewer1"/>
       </Triggers>
    </asp:UpdatePanel>
    

    同时检查您是否为页面启用了ViewState

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-12
      • 1970-01-01
      • 2017-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多