简体   繁体   English

Crystal Report-将不同的报告导出到一个PDF文件

[英]Crystal Report - Export different reports to one PDF file

i'm working in a mvc4 web application and i'm trying to export a report "Crystal Report" to a pdf file. 我正在使用mvc4 Web应用程序,并且正在尝试将报告“晶体报告”导出为pdf文件。 My problem is when i want to export more than one report into the same pdf file. 我的问题是,当我想将多个报告导出到同一pdf文件中时。 Do somebody have any idea to do that? 有人有这样做的想法吗? I can export one report to a pdf file with the following code: 我可以使用以下代码将一份报告导出为pdf文件:

public ActionResult ReporteListadoUnidades(int idConsorcio, int? idCentroCosto)
    {
        try
        {

            DataSet datos = new DataSet();

            LoadDatos(ref datos);

            ....

            ReportDocument rptCV = new ReportDocument();
            rptCV.Load(Server.MapPath("~/Reports/repUnidades.rpt"));
            rptCV.SetDataSource(datos);

            Stream stream = rptCV.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            return File(stream, "application/pdf");
        }
        catch (Exception)
        {
            throw;
        }
    }

And the result is the following: (Image not available because i don't have reputation to post it) 结果如下:(图像不可用,因为我没有发布它的声誉)

As you can see, all of this run well, but i would like to export different reports together in the same pdf file. 如您所见,所有这些都运行良好,但是我想将不同的报告一起导出到同一pdf文件中。

You will have to use a 3rd party library such as PDFSharp, iTextSharp or atalasoft. 您将不得不使用第三方库,例如PDFSharp,iTextSharp或atalasoft。 They will support merging multiple streams (or files, which ever way you want to do it) into one stream (or file) then writing it like normal. 他们将支持将多个流(或文件,无论您要使用哪种方式)合并到一个流(或文件)中,然后像平常一样将其写入。

Do you care about bookmarks in the document? 您是否关心文档中的书签? That makes things a little harder. 这使事情变得有点困难。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM