將ReportingService產生的報表匯出成Excel

文章分類: C#




Reporting Service有內建按鈕可已匯出成Excel

可是如果遇到User希望直接匯出(User通常都比較懶惰,沒辦法Orz)的時候,也可以用程式自動處理

?View Code CSHARP
                Warning[] warnings;
                string[] streamids;
                string mimeType;
                string encoding;
                string extension;
 
                byte[] bytes = rptView.ServerReport.Render(
                   "Excel", null, out mimeType, out encoding, out extension,
                   out streamids, out warnings);
 
                System.IO.FileStream fs = new System.IO.FileStream(saveFileDialog1.FileName, System.IO.FileMode.Create);
                fs.Write(bytes, 0, bytes.Length);
                fs.Close();

相關文章 :

  1. [C#].Net編碼轉換 Unicode to Big5

發表回應

Bad Behavior has blocked 36 access attempts in the last 7 days.