[ Dragan BL @ 25.08.2011. 11:00 ] @
Da li je moguce da kada zelim da exportujem report u PDF dobijem da se PDF otvara u brauzeru a ne da mi nudi da downloadujem to? Moze li se to kako zaobici promijeniti header IIS bilo sta? Hvala |
[ Dragan BL @ 25.08.2011. 11:00 ] @
[ sparc @ 25.08.2011. 11:57 ] @
ja koristim sledeci kod da RDLC direktno prikazem u PDF-u ili u Excel-u.
Ovaj kod je na stanici koja sadrzi reportViewer. Imports System.Web Imports Microsoft.Reporting Imports Microsoft.Reporting.WebForms Imports System.IO Imports System.Data .............. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Session("fileType") = Request.QueryString("fileType") Session("fileName") = Request.QueryString("fileName") Session("contType") = Request.QueryString("contType") End Sub Protected Sub Page_SaveStateComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SaveStateComplete Dim warnings As Warning() = Nothing Dim streamids As String() = Nothing Dim mimeType As String() = Nothing Dim encoding As String = Nothing Dim extension As String = Nothing Dim bytes As Byte() 'proveravamo da li postoji file i ako postoji brisemo ga Dim filepath As String = Server.MapPath("~/Izvestaji") & "\" & Session("fileName") File.Delete(filepath) 'render reporta bytes = ReportViewer1.LocalReport.Render(Session("fileType"), Nothing, Nothing, encoding, extension, streamids, warnings) Dim fs As New FileStream(filepath, FileMode.Create) fs.Write(bytes, 0, bytes.Length) fs.Close() 'prikaz Select Case Session("fileType") Case "PDF" Response.ContentType = Session("contType") Response.WriteFile(filepath) Response.End() Case "Excel" HttpContext.Current.Response.Clear() HttpContext.Current.Response.ContentType = Session("contType") HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" & Session("fileName")) HttpContext.Current.Response.BinaryWrite(bytes) HttpContext.Current.Response.End() Case Else End Select End Sub A stranicu pozivam na sledeci nacin: Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click Response.Redirect("Imestranice.aspx" & "?fileType=PDF&fileName=Imefajla.PDF&contType=Application/pdf") End Sub [ Dragan BL @ 25.08.2011. 12:54 ] @
Nasao sam i ja nesto slicno tome...evo linka na koji sam ja mislio da to sredim ...XXXX.rdl&rs:Format=PDF&rs:Command=Render&Jezik=lat&CSID=226&IzdatiIzvodiID=60 e sada on ponudi da se to snimi, a ja bi htio da otvori INLINE (u brazueru).
Ovo sam isto nasao da postoji ali ne znam da li to radi i je li neko to probao ReportViewer.ExportContentDisposition Property? Hvala Copyright (C) 2001-2024 by www.elitesecurity.org. All rights reserved.
|