2013-05-01 14 views
0

我正在從Intranet站點加載SSRS報告。當我轉到SSRS報告管理器並將文檔導出到Excel時,它將導出所有項目。當通過網址訪問時,SSRS到Excel缺失圖像和標題

然而,當我做同樣的事情,但通過網頁我錯過了一些頭文件和圖像。

這裏是我的C#代碼

Microsoft.Reporting.WebForms.ReportViewer rview = new Microsoft.Reporting.WebForms.ReportViewer(); 
        rview.ServerReport.ReportServerUrl = new Uri(uri); 
        rview.ServerReport.ReportPath = "/T200/MiscAsset"; 

        //For the ReportServerCredentials public class CustomReportCredentials must be added to the code 
        Microsoft.Reporting.WebForms.IReportServerCredentials irsc = new CustomReportCredentials(user, pass, domain); 
        rview.ServerReport.ReportServerCredentials = irsc; 

        if (_mode == null) 
        { 
         _mode = "PDF"; 
        } 

        string deviceInfo, mimeType, encoding, extention; 
        string[] streamaids; 
        Microsoft.Reporting.WebForms.Warning[] warnings; 
        deviceInfo = "<DeviceInfo>" + "<SimplePageHeaders>True</SimplePageHeaders>" + "</DeviceInfo>"; 
        byte[] bytes = rview.ServerReport.Render(_mode, deviceInfo, out mimeType, out encoding, out extention, out streamaids, out warnings); 
        Response.Clear(); 

        if (_mode == "PDF") 
        { 
         Response.ContentType = "application/pdf"; 
         Response.AddHeader("Content-disposition", "filename=MiscAsset.pdf"); 
        } 
        else if (_mode == "excel") 
        { 
         Response.ContentType = "application/vnd.ms-excel"; 
         Response.AddHeader("Content-disposition", "filename=MiscAsset.xls"); 
        } 
        Response.OutputStream.Write(bytes, 0, bytes.Length); 
        Response.OutputStream.Flush(); 
        Response.OutputStream.Close(); 
        Response.Flush(); 
        Response.Close(); 
+0

你到目前爲止解決了什麼問題?你遇到了什麼問題,你在調試過程中得到了什麼信息? – Jeroen 2013-05-01 18:36:40

回答

0

嵌入在報告中,或外部的圖像?如果它們是外部的,則需要確保在網頁中查看時,用戶具有查看外部圖像的必要權限。

至於標題,你的代碼是設置SimplePageHeaders = True。這意味着,將報表導出到Excel時,報表標題將呈現爲Excel頁面標題,而不是作爲工作表的一部分。嘗試將其設置爲False。