Este es un link permanente de RE: Ayuda plis, generar PDF de Crystal Reports sin visualizar reporte..
Puedes volver a ver el tema completo o ir al Familia Visual Studio
10/06/2008 21:52:07
Julio
Fecha de registro: 27/08/2008
1 post en este tema
1 post en familia visual studio
11 posts en todos los foros
RE: Ayuda plis, generar PDF de Crystal Reports sin visualizar reporte.
Responder  Citar
Acá está una subrutina para crear un PDF.
_sPathReporte es la ruta donde está el archivo de Crystal (.rpt).
_Reporte es el nombre del archivo .rpt.
adjunto es el nombre del archivo PDF que se va a generar.
Saludos.

 Private Sub Exportar(ByVal adjunto As String)
Dim rptDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument

_sPathReporte = CType(configurationAppSettings.GetValue("PathReportes", GetType(System.String)), String)
rptDocument.Load(_sPathReporte & _Reporte & ".rpt")
rptDocument.SetDataSource(_dtTabla)
ReportViewer.ReportSource = rptDocument

Dim filedest As New CrystalDecisions.Shared.DiskFileDestinationOptions
Dim o As CrystalDecisions.Shared.ExportOptions
o = New CrystalDecisions.Shared.ExportOptions
o.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat
o.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile
filedest.DiskFileName = System.IO.Directory.GetCurrentDirectory() & "\" & adjunto & ".pdf"

o.ExportDestinationOptions = filedest.Clone
rptDocument.Export(o)

filedest = Nothing
o = Nothing
End Sub