views:

228

answers:

1

Using Winforms, C#, .Net 3.5, and Microsoft ReportViewer 2008:

I have a 3 page report in ReportViewer that I want to send to PDF as different pages. I have the code below that will copy all 3 pages to PDF but is there a way of splitting up the pages or specifying which page to render into PDF? It knows there are 3 pages... so seems like there should be something but I've not found it yet.

Thanks for the help in advance!

int numPages = reportViewer.LocalReport.GetTotalPages();

byte[] bytes = reportViewer.LocalReport.Render(
   "PDF", null, out mimeType, out encoding, out filenameExtension,
   out streamids, out warnings);

using (FileStream fs = new FileStream(exportPath, FileMode.Create))
{
   fs.Write(bytes, 0, bytes.Length);
}
+1  A: 

Would it be possible to make three different reports, one for each page? Then you could set the .rpt name in the c# based on whatever the user selects...

Albert
I have a master form and 3 seperate pages now. The master has the headers and footers along with the water mark and some other functionality. So, it would be possible but not very OO.
Billy