簡體   English   中英

如何在 ASP.Net 和 C# web 頁面中將 Reporting Services 報表顯示為內聯 PDF?

[英]How to display a Reporting Services report as an inline PDF, in a ASP.Net and C# web page?

我需要在 ASP.Net web 頁面中顯示報告的預覽(使用 C# 服務器端腳本)。 預覽需要是 PDF 而不是 HTML 並內聯顯示(可能在 iframe 中?)。

是否可以指定呈現為 PDF 的報告的標題,因此它的“內容處置”是內聯而不是附件?

或者有沒有其他方法可以在 ASP.Net web 頁面中顯示呈現為 PDF 內聯的報表?


我正在使用 Reporting Services 2008

在 ASP.Net 站點中,我使用 web 對 ReportService2005.asmx 和 ReportExecution2005.asmx 的引用

我正在做一些非常相似的事情。 但我使用的是 HttpWebRequest 而不是使用該服務。 這就是我的做法。 重要的部分是 Content-Disposition 中文件名之前的內聯

這還取決於他們的 Adobe Reader 版本(我們發現他們需要 7 或更高版本)以及他們在其中設置的設置(以防他們將其設置為不在瀏覽器中打開 PDF)。

HttpResponse currentResponse = HttpContext.Current.Response;
currentResponse.Clear();
currentResponse.ClearHeaders();
currentResponse.ClearContent();

filename = String.Format("{0}.pdf", this.ReportName);
currentResponse.AppendHeader("Content-Disposition", String.Format("inline;filename={0}", filename));
currentResponse.ContentType = "Application/PDF";

//Copy the content of the response to the 
//current response using BinaryWrite
snip....

currentResponse.End();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM