Content Disposition Dinamico
This commit is contained in:
@@ -5444,13 +5444,13 @@ Public Class ClsPaginas
|
||||
''' <param name="NombreArchivo">Opcional Nombre del archivo que se descarga</param>
|
||||
''' <param name="Formato">Optional, Formato de Generacion PDF o Excel</param>
|
||||
''' <remarks></remarks>
|
||||
Public Sub ImprimirPDF(RutaReporte As String, DtDatos As DataTable, Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional RDSName As String = "DataSet1", Optional MR As ReportViewer = Nothing)
|
||||
Public Sub ImprimirPDF(RutaReporte As String, DtDatos As DataTable, Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional RDSName As String = "DataSet1", Optional MR As ReportViewer = Nothing, Optional Content_Disposition As String = "attachment")
|
||||
Dim lrds As New List(Of ReportDataSource)
|
||||
Dim rds As New ReportDataSource
|
||||
rds.Name = RDSName
|
||||
rds.Value = DtDatos
|
||||
lrds.Add(rds)
|
||||
ImprimirPDF(RutaReporte, lrds, Parametros, NombreArchivo, Formato, MR)
|
||||
ImprimirPDF(RutaReporte, lrds, Parametros, NombreArchivo, Formato, MR, Content_Disposition)
|
||||
End Sub
|
||||
Public Sub ImprimirPDFMultiDS(RutaReporte As String, lrds As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional RDSName As String = "DataSet1", Optional MR As ReportViewer = Nothing)
|
||||
ImprimirPDF(RutaReporte, lrds, Parametros, NombreArchivo, Formato, MR)
|
||||
@@ -5465,9 +5465,9 @@ Public Class ClsPaginas
|
||||
''' <param name="NombreArchivo">Opcional Nombre del archivo que se descarga</param>
|
||||
''' <param name="Formato">Optional, Formato de Generacion PDF o Excel</param>
|
||||
''' <remarks></remarks>
|
||||
Public Sub ImprimirPDF(RutaReporte As String, DataSource As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportViewer = Nothing)
|
||||
Public Sub ImprimirPDF(RutaReporte As String, DataSource As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportViewer = Nothing, Optional Content_Disposition As String = "attachment")
|
||||
'limpio ReportViwer
|
||||
ImprimirbytesPDF(StreamPDF(RutaReporte, DataSource, Parametros, NombreArchivo, Formato, MR), NombreArchivo, Formato)
|
||||
ImprimirbytesPDF(StreamPDF(RutaReporte, DataSource, Parametros, NombreArchivo, Formato, MR), NombreArchivo, Formato, Content_Disposition:=Content_Disposition)
|
||||
End Sub
|
||||
Public Function StreamPDF(RutaReporte As String, DtDatos As DataTable, Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional RDSName As String = "DataSet1", Optional MR As ReportViewer = Nothing) As Byte()
|
||||
Dim lrds As New List(Of ReportDataSource)
|
||||
@@ -5857,7 +5857,7 @@ Public Class ClsPaginas
|
||||
''' <param name="NombreArchivo"></param>
|
||||
''' <param name="Formato"></param>
|
||||
''' <remarks></remarks>
|
||||
Public Sub ImprimirbytesPDF(bytes As Byte(), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional Descarga As Boolean = False)
|
||||
Public Sub ImprimirbytesPDF(bytes As Byte(), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional Descarga As Boolean = False, Optional Content_Disposition As String = "attachment")
|
||||
'limpio ReportViwer
|
||||
Dim mimeType As String = Nothing
|
||||
Dim extension As String = Nothing
|
||||
@@ -5880,7 +5880,7 @@ Public Class ClsPaginas
|
||||
Response.Buffer = True
|
||||
Response.Clear()
|
||||
Response.ContentType = mimeType
|
||||
Response.AddHeader("content-disposition", String.Format("attachment; filename={0}.{1}", NombreArchivo, If(Formato = "PDF", "pdf", "xls")))
|
||||
Response.AddHeader("content-disposition", String.Format("{0}; filename={1}.{2}", Content_Disposition, NombreArchivo, If(Formato = "PDF", "pdf", "xls")))
|
||||
Response.BinaryWrite(bytes) ' create the file
|
||||
Response.Flush() ' send it to the client to download
|
||||
HttpContext.Current.Response.SuppressContent = True
|
||||
|
||||
Reference in New Issue
Block a user