I have some code in a class that I use to export a report to pdf without having to use a report viewer and it works great except that the user is always prompted to Open or Save the report. I want the report to open directly in a new page without the prompt. I also would like to make the cursor change while the report is rendering so the user knows the print button was actually clicked. Thanks for any help.
He is my class code :
Here is the Buttons click event (along with page declarations)
Imports Telerik.Reporting.Processing
He is my class code :
Imports Microsoft.VisualBasic | |
Imports Telerik.Reporting.Processing | |
Imports MyTelerikLibrary | |
Public Class TelerikFunctions | |
Inherits System.Web.UI.Page | |
Public Function ExportToPDF(ByVal reportToExport As Telerik.Reporting.Report) As Telerik.Reporting.Report | |
Dim reportProcessor As New Telerik.Reporting.Processing.ReportProcessor() | |
Dim result As RenderingResult = reportProcessor.RenderReport("PDF", reportToExport, Nothing) | |
Dim fileName As String = result.DocumentName + ".pdf" | |
HttpContext.Current.Response.Clear() | |
HttpContext.Current.Response.ContentType = result.MimeType | |
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.Private) | |
HttpContext.Current.Response.Expires = -1 | |
HttpContext.Current.Response.Buffer = True | |
HttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("{0};FileName=""{1}""", "attachment", fileName)) | |
HttpContext.Current.Response.BinaryWrite(result.DocumentBytes) | |
HttpContext.Current.Response.End() | |
End Function | |
End Class |
Imports Telerik.Reporting.Processing
Imports MyTelerikLibrary
Dim tF As New TelerikFunctions | |
Dim rv = New RwpListingD007() | |
tF.ExportToPDF(rv) | |