2009-05-05 40 views

回答

2

爲了解決網絡前端(這使我瘋狂使用ReportViewer網絡控制)這個問題,我意識到SSRS返回數據作爲字節數組,然後可以處理。所以捕捉.NET流,你可以寫,做類似的方法:

private byte[] ExportStream(string streamType, out string mimeType, out string extension) 
{ 
    Microsoft.Reporting.WebForms.Warning[] warnings; 
    string[] streamids; 
    string encoding; 
    string deviceInfo = "<DeviceInfo><SimplePageHeaders>True</SimplePageHeaders></DeviceInfo>" 

    byte[] bytes = ReportViewerClientReport.ServerReport.Render(streamType, 
          deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings); 

    return bytes; 
} 

然後後處理從該方法的輸出的東西,如夢幻般的NPOI庫從http://npoi.codeplex.com/無論是作爲字節或創造某種內存流,那麼你可以做任何你想做的事情。

須─注意,SSRS(SQL Server報表服務)R2都會有這樣的功能,但它出來約2010年5月http://www.bidn.com/blogs/bretupdegraff/bidn-blog/234/new-features-of-ssrs-2008-r2-part-1-naming-excel-sheets-when-exporting-reports

1

如果要在導出時在選項卡中分解報表,請使用帶分頁符的多表。

您無法重命名SSRS中的選項卡。如果您想重命名標籤,您需要編寫自定義代碼。

+0

是否有任何的源代碼周圍嗎? – GordyII 2009-05-05 21:20:42

相關問題