views:

31

answers:

1

I'm trying to output a report as pdf and everything seems fine except I'm seeing only one page in the final output. The datasrouce is showing a count 2 but the final report shows only 1 page.

This is what I have in code:

if (reportType == ReportType.AllJobs)
 {
     dataSource = BRInfoGateway.GetAllJobs(); //This shows a count of 2 during debug
     reportName = "./Reports/AllJobs.rdlc";
 }
 else                      
 {
     dataSource = BRInfoGateway.GetJob(jobContext);
     reportName = "./Reports/SpecificJob.rdlc";
 }

 var report = new LocalReport();
 report.ReportPath = reportName;
 report.DataSources.Add(new ReportDataSource("BRInfo", dataSource));

 Warning[] warnings;
 string[] streamids;
 string mimeType;
 string encoding;
 string extension;

 return report.Render("PDF", null, out mimeType, out encoding, out extension, 
     out streamids, out warnings);

Then in my test I'm just saving the byte[]. Pretty normal stuf...

    var reportData = Reports.ReportsGateway.GetReport(Reports.ReportType.AllJobs, null);
string filename = "AllJobs.pdf";
if(File.Exists(filename)) File.Delete(filename);
using (FileStream fs = File.Create(filename))
{
    fs.Write(reportData, 0, reportData.Length);
}

Any thoughts. I'm not sure if I have to do something specific in the report template!

A: 

I got it to work by using a new report instead of the wizard...no idea why !

Sunit