Export Report to Memory Stream - RDL Multi-Section Report

Posted by: mlocke on 3 May 2023, 7:40 am EST

    • Post Options:
    • Link

    Posted 3 May 2023, 7:40 am EST - Updated 3 May 2023, 7:45 am EST

    ActiveReports 17

    Hi! How can I export a RDL Multi-Section report to memory stream? We have some older, winform reports in ActiveReports 14 that uses this code:

     Dim memStream As New System.IO.MemoryStream
     Dim pdfExport As New GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport
     Dim docAllInvoices As New GrapeCity.ActiveReports.Document.SectionDocument
    
     pdfExport.Export(docAllInvoices, memStream)

    I’m using this in a C# web service and have this code:

     PageReport pageReport = new PageReport();
     System.IO.FileInfo fi = new System.IO.FileInfo("C:\\My Dev\\Reports\\MyReport.rdlx");
    
    //tried this but this fails because it's not a section report
     GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport pdfExport = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();
     System.IO.MemoryStream memStream = new MemoryStream();
     
    pdfExport.Export(pageReport, memStream);
    
    //so tried this but this fails because of the screenshot included
     GrapeCity.ActiveReports.Export.Pdf.Page.PdfExport pdfExport = new GrapeCity.ActiveReports.Export.Pdf.Page.PdfExport();
    System.IO.MemoryStream memStream = new MemoryStream();
    pdfExport.Export(pageReport.Report, memStream);

    I tried to locate this information in the documentation but I only come up with how to do this with Section reports, like here:

    https://www.grapecity.com/activereportsnet/docs/latest/online/GrapeCity.ActiveReports.Export.Pdf~GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport~Export.html

    Thanks!

  • Posted 3 May 2023, 11:03 pm EST

    Hi Melissa,

    We were able to replicate the same on our end when exporting a PageReport to PDF using PDF ExportFilter, we have escalated the same to our development team for their insights on this [Ticket ID: AR-30823].

    For now, to export your PageReport to a MemoryStream you can use the PdfRenderingExtension and export your report to MemoryStream using the following code:

    MemoryStreamProvider memoryStreamProvider = new MemoryStreamProvider();
    pageReport.Document.Render(pdfRenderingExtension, memoryStreamProvider, pdfSetting);           
    MemoryStream ms= memoryStreamProvider.GetPrimaryStream().OpenStream() as MemoryStream;
    

    Please find attached a sample for the same.

    Regards,

    Anand

    RdlToPDF_MemoryStream.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels