Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Export Crystal Report to PDF and open it in Acrobat Reader instead of Internet Explorer (http://www.velocityreviews.com/forums/t92815-export-crystal-report-to-pdf-and-open-it-in-acrobat-reader-instead-of-internet-explorer.html)

Dave 12-15-2004 04:54 PM

Export Crystal Report to PDF and open it in Acrobat Reader instead of Internet Explorer
 
Is this possible? Here is my current code (which opens the pdf in Internet
Explorer)

Dim crReportDocument As
CrystalDecisions.CrystalReports.Engine.ReportDocum ent
Dim crExportOptions As CrystalDecisions.shared.ExportOptions
Dim crDiskFileDestinationOptions As
CrystalDecisions.shared.DiskFileDestinationOptions
Dim Fname As String
crReportDocument = New
CrystalDecisions.CrystalReports.Engine.ReportDocum ent
crReportDocument.Load("C:\Inetpub\wwwroot\SAFDB\Jo bHoursReport.rpt")
Try
Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo

For Each tbCurrent In crReportDocument.Database.Tables
tliCurrent = tbCurrent.LogOnInfo
With tliCurrent.ConnectionInfo
.ServerName = "NOVAPRJ"
.UserID = "sa"
.Password = "sa"
.DatabaseName = "NSSApplication"
End With
tbCurrent.ApplyLogOnInfo(tliCurrent)
Next tbCurrent
Catch ex As Exception
Response.Write(ex.Message)
Finally
End Try

Dim StartYear As Integer
Dim StartMonth As Integer
Dim StartDay As Integer
Dim EndYear As Integer
Dim EndMonth As Integer
Dim EndDay As Integer

crReportDocument.Refresh()
Fname = "c:\Reports\" & Session.SessionID.ToString & ".pdf"
crDiskFileDestinationOptions = New
CrystalDecisions.shared.DiskFileDestinationOptions
crDiskFileDestinationOptions.DiskFileName = Fname
crExportOptions = crReportDocument.ExportOptions
With crExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType =
CrystalDecisions.Shared.ExportDestinationType.Disk File
.ExportFormatType =
CrystalDecisions.Shared.ExportFormatType.PortableD ocFormat
End With
crReportDocument.Export()
' The following code writes the pdf file to the Client's browser.
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
'Response.WriteFile(Fname)
Response.Redirect(Fname)
Response.Flush()
Response.Close()
Response.ClearContent()
Response.End()
System.IO.File.Delete(Fname)
crReportDocument.Close()




All times are GMT. The time now is 04:46 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.