2010-05-12 53 views
2

使用的WinForms,C#,.net 3.5和Microsoft的ReportViewer 2008的ReportViewer報告。我有下面的代碼將所有3頁複製到PDF,但有沒有辦法分裂頁面或指定哪個頁面呈現爲PDF?它知道有3頁...所以似乎應該有一些東西,但我還沒有找到它。爲PDF文件

感謝您的幫助!

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

是否可以製作三份不同的報告,每份報告一份?然後你可以在c#中設置.rpt的名字,根據用戶的選擇...

+0

我現在有一個主表單和3個單獨的頁面。主人有標題和頁腳連同水印和一些其他功能。所以,這將是可能的,但不是很OO。 – Billy 2010-05-12 17:37:39