Quantcast
Channel: SQL Server Reporting Services
Viewing all articles
Browse latest Browse all 1418

I need to do 3 copies of the same RDLC? HOW TO??

$
0
0

 Hi, i have a report (RDLC). I generate it with the control reportViewer, and in the code i use the next lines to generate it:

  

              LocalReport localReport = new LocalReport();


               .... LOAD DATASETS ...     


                localReport.SubreportProcessing += new SubreportProcessingEventHandler(localReport_SubreportProcessing);
                localReport.Refresh();

                string reportType = "PDF";
                string mimeType;
                string encoding;
                string fileNameExtension;

                string deviceInfo = "<DeviceInfo>" + 
               "  <OutputFormat>PDF</OutputFormat>" +
               "  <PageWidth>8.2in</PageWidth>" +
               "  <PageHeight>11.6in</PageHeight>" +
               "  <MarginTop>0.4in</MarginTop>" +
               "  <MarginLeft>0.4in</MarginLeft>" +
               "  <MarginRight>0.4in</MarginRight>" +
               "  <MarginBottom>0.4in</MarginBottom>" +
               "</DeviceInfo>";

                Warning[] warnings;
                string[] streams;

                byte[] renderedBytes;

                //Render the report
                localReport.ReportPath = Server.MapPath("~/reports/MAGRP_Total.rdlc");
                renderedBytes = localReport.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);

                Response.Clear();
                Response.ContentType = "application/pdf";
                Response.AddHeader("content-disposition", "attachment; filename=" + ReportName + ".pdf");
                Response.Charset = string.Empty;
                Response.OutputStream.Write(renderedBytes , 0, renderedBytes .Length);
                Response.Flush();
                Response.Close();

 

With this code, the report runs good. the problem is that I need to generate 3 copies of the same report. I have tried to concatenatex3 therenderedBytes,  by the result is a report with a size x 3, but with only the number of pages of 1 copy of the report.

At the moment, I have a main report in which i have 3 reports (the same report x 3), but I think this is not the most efficient way to do it, because with this way i need to load the datasets of the subreports x 3.

Anyone knows any way to do it more efficient? Only with 1 report but doing anything in the code which avoid to do more copies??

 

 

 

 

 

 


Viewing all articles
Browse latest Browse all 1418

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>