C# – Render multiple reports in one report viewer (rdlc)

asp.netcrdlcreporting-servicesreportviewer

Using ReportViewer i want to render multiple reports in one pdf using rdlc file.

Byte pdfByte = Byte();
pdfByte = ReportViewer.LocalReport.Render("PDF", Nothing, mimeType, encoding, extensions, stream, warning);
Response.Clear();
Response.ContentType = mimeType;
Response.AddHeader("content-disposition", "attachment; filename=myfile." + extension);
Response.BinaryWrite(pdfByte);
Response.Flush();
Response.End();

This only generate only one report in pdf. But i want to get multiple reports rendered in one pdf file.

Please help me.

Best Answer

The easiest way to do this would be to design all the reports to be sub-reports of one main report. Then, by default all reports will be rendered in one PDF.

There's a couple of videos demonstrating sub-reports here: Part 1 & Part 2

If you can't structure your reports into sub-reports, then there is good & bad news...

Bad news: there's no straightforward way to achieve this in the framework.

Good news: it's possible by using the PDFsharp 3rd-party library. It's open source & free to use, even in commercial applications.

See previous question: Rendering multiple .rdlc reports into a single PDF using PDFSharp

Good luck!

Related Topic