【问题标题】:How to view Crystal Report without CrystalReportViewer?如何在没有 CrystalReportViewer 的情况下查看 Crystal Report?
【发布时间】:2017-06-08 14:08:55
【问题描述】:

我有一个 Web 应用程序,我只需要在其中查看嵌入在网页中的报告。我不想要 CrystalReportViewer 侧面控件,如打印、缩放、分页等。它的外观和感觉应该像扫描的文档图片。有什么帮助吗?

【问题讨论】:

  • 生成PDF怎么样?
  • 好主意。我真的很感激。

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


【解决方案1】:

是的,这是可能的。这是一个将水晶报表对象(在内存流中)转换为 Pdf、Word 或 Excel 的代码 sn-p。

        using CrystalDecisions.Web;
        using CrystalDecisions.Shared;
        using CrystalDecisions.CrystalReports.Engine;

        ReportDocument rpt = new ReportDocument();
        string path2 =  path + reportName;
        rpt.Load(path2);
        CrystalDecisions.CrystalReports.Engine.Database crDatabase = rpt.Database;
        ConnectionInfo crConnectionInfo = new ConnectionInfo();
        crConnectionInfo.ServerName = server;
        crConnectionInfo.DatabaseName = db;
        crConnectionInfo.UserID = crystalUser;
        crConnectionInfo.Password = pwd;
        crConnectionInfo.IntegratedSecurity = false;

        <<<<<<report logic here>>>>>>>>>>>

        CrystalDecisions.Shared.ExportFormatType typ = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;
        if (exportFormatType == "doc")
            typ = CrystalDecisions.Shared.ExportFormatType.WordForWindows;
        if (exportFormatType == "xls")
            typ = CrystalDecisions.Shared.ExportFormatType.Excel;

        MemoryStream ms = (MemoryStream)rpt.ExportToStream(typ);

【讨论】:

  • 虽然您在将其导出为 pdf 后忘记提及 。但我会认为这是我的答案。谢谢。
猜你喜欢
  • 2011-05-30
  • 2011-10-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-01-10
  • 1970-01-01
  • 2023-03-09
相关资源
最近更新 更多