简体   繁体   中英

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. My problem is when i want to export more than one report into the same pdf file. Do somebody have any idea to do that? I can export one report to a pdf file with the following code:

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.

You will have to use a 3rd party library such as PDFSharp, iTextSharp or 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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