2009-11-07 72 views
0

我想输出一份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); 

然后在我的测试,我只是保存的byte []。漂亮的普通学生...

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

任何想法。我不确定是否必须在报告模板中执行特定的操作!

+0

这不是Crystal Reports,这是Reporting Services – MartW 2009-11-08 01:32:01

回答

0

我通过使用新的报告而不是向导来使用它......不知道为什么!