仅报告输出第一页

时间:2009-11-07 04:18:24

标签: c# reporting-services

我正在尝试将报告输出为pdf,除了我在最终输出中只看到一页之外,一切似乎都很好。 datasrouce显示计数2,但最终报告仅显示1页。

这就是我在代码中所拥有的:

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);

然后在我的测试中我只是保存字节[]。很正常的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);
}

任何想法。我不确定我是否必须在报告模板中做一些特定的事情!

1 个答案:

答案 0 :(得分:0)

我使用新报告代替向导让它工作......不知道为什么!