Reports to PDF URGENT!!!
- From: "SergioT" <fliatardio_no@xxxxxxxxxxxxxxxx>
- Date: Fri, 23 Sep 2005 09:37:10 -0400
Hi
I've installed my asp.net on a win2003,
I 've give permissions to c:\windows\temp to IIS_WPG, so I can see reports
on the crystal web-viewer and it works just fine.
My problem shows up when I try to expor a report to PDF or excel or
whatever, I got this error
========================
Error en archivo
C:\WINDOWS\TEMP\temp_e64e745d-cff0-4c57-96c2-4ce0c58084ff.rpt: Denegado el
acceso al archivo del informe. Es posible que esté abierto en otro programa.
========================
I guess I can translate ,something like this:
File's error C:\WINDOWS\TEMP\temp_e64e745d-cff0-4c57-96c2-4ce0c58084ff.rpt:
Access denied It may be used by another program
I do the exportation to c:\inetput\wwwroot\mySite\Exports, this folder have
the same permissions than c:\inetput\wwwroot\mySite
I don't think that there is a problem on the code, because it works fine on
my development's computer, any way, the exportation to pdf is made for a
class that have a method name and part of the code of that method is
showed below
Dim crExportOptions As CrystalDecisions.shared.ExportOptions
Dim crDiskFileDestinationOptions As
CrystalDecisions.shared.DiskFileDestinationOptions
Dim sFname As String
Dim sDownUrl As String
sDownUrl = System.Web.HttpContext.Current.Request.Url.Scheme &
System.Web.HttpContext.Current.Request.Url.SchemeDelimiter &
System.Web.HttpContext.Current.Request.Url.Host &
System.Web.HttpContext.Current.Request.ApplicationPath
''Pass the populated dataset to the report
' Primero debemos crear una nueva instancia de la clase
DiskFileDestinationOptions
' y definir las variables crExportOptions del la clase ExportOptions
del crReportDocument
crDiskFileDestinationOptions = New
CrystalDecisions.Shared.DiskFileDestinationOptions
crExportOptions = cr.ExportOptions
sFname =
System.Web.HttpContext.Current.Request.PhysicalApplicationPath & "\Exports\"
& System.Web.HttpContext.Current.Session.SessionID & ".pdf"
crDiskFileDestinationOptions.DiskFileName = sFname
'set the required report ExportOptions properties
With crExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType =
CrystalDecisions.Shared.ExportDestinationType.DiskFile
.ExportFormatType =
CrystalDecisions.Shared.ExportFormatType.PortableDocFormat
End With
' Export the report
cr.Export()
'Writing the pdf on the client's IE
System.Web.HttpContext.Current.Response.ClearContent()
System.Web.HttpContext.Current.Response.ClearHeaders()
System.Web.HttpContext.Current.Response.ContentType =
"application/pdf"
System.Web.HttpContext.Current.Response.WriteFile(sFname)
System.Web.HttpContext.Current.Response.Flush()
System.Web.HttpContext.Current.Response.Close()
'Borra el archivo pdf
System.IO.File.Delete(sFname)
Thanks in advance!!
Sergio
.
- Follow-Ups:
- Re: Reports to PDF URGENT!!!
- From: Richard Dudley
- Re: Reports to PDF URGENT!!!
- Prev by Date: Re: Week to Date
- Next by Date: Re: Freezing Panes in Crystal
- Previous by thread: How to view Crystal Reports Version 10 on Crystal Enterprise Folder from VB ?
- Next by thread: Re: Reports to PDF URGENT!!!
- Index(es):
Relevant Pages
|