2009-11-07 80 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

我通過使用新的報告而不是嚮導來使用它......不知道爲什麼!