B
Bernard Goh
Hi All,
I am newbie for ASP.NET programming and I am having this error when I tried
to print a crytal report from my dotnet web application.
Error Message :
Invalid file name.
at .K(String , EngineExceptionErrorID ) at .F(Int16 , Int32 ) at
CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestCont
ext reqContext) at
CrystalDecisions.CrystalReports.Engine.FormatEngine.Export() at
CrystalDecisions.CrystalReports.Engine.ReportDocument.Export() at
CrystalWeb.ReportPrinter.Page_Init(Object sender, EventArgs e) in
c:\inetpub\wwwroot\CrystalWeb\ReportPrinter.aspx.vb:line 42
Following is my code for the printing :
Dim crReportDocument As ReportDocument
Dim crExportOptions As ExportOptions
Dim crDiskFileDestinationOptions As DiskFileDestinationOptions
Dim Fname As String
crReportDocument = New ReportDocument()
crReportDocument.Load("C:\Inetpub\wwwroot\CrystalWeb\CrystalReport\Report1.r
pt")
Fname = "C:\Inetpub\wwwroot\CrystalWeb\Download\" &
Session.SessionID.ToString & ".pdf"
crDiskFileDestinationOptions = New DiskFileDestinationOptions()
crExportOptions = crReportDocument.ExportOptions
With crExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
End With
Try
crReportDocument.Export() ' <-----Error Occured Here
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(Fname)
Response.Flush()
Response.Close()
System.IO.File.Delete(Fname)
Catch err As Exception
Response.Write("<BR><BR>")
Response.Write(err.Message.ToString)
Response.Write("<BR><BR>")
Response.Write(err.StackTrace.ToString)
End Try
I exhausted all method that i know of and still don't know what is wrong.
anyone can help me out with this ?
Any help is very much appreciated.
--
Bernard Goh
IT Administrator
Success Electronics & Transformer Manufacturer Sdn Bhd
No.5 & 7,Jalan TSB 8
Taman Industri Sg. Buloh
47000 Sg.Buloh
Selangor Darul Ehsan
I am newbie for ASP.NET programming and I am having this error when I tried
to print a crytal report from my dotnet web application.
Error Message :
Invalid file name.
at .K(String , EngineExceptionErrorID ) at .F(Int16 , Int32 ) at
CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestCont
ext reqContext) at
CrystalDecisions.CrystalReports.Engine.FormatEngine.Export() at
CrystalDecisions.CrystalReports.Engine.ReportDocument.Export() at
CrystalWeb.ReportPrinter.Page_Init(Object sender, EventArgs e) in
c:\inetpub\wwwroot\CrystalWeb\ReportPrinter.aspx.vb:line 42
Following is my code for the printing :
Dim crReportDocument As ReportDocument
Dim crExportOptions As ExportOptions
Dim crDiskFileDestinationOptions As DiskFileDestinationOptions
Dim Fname As String
crReportDocument = New ReportDocument()
crReportDocument.Load("C:\Inetpub\wwwroot\CrystalWeb\CrystalReport\Report1.r
pt")
Fname = "C:\Inetpub\wwwroot\CrystalWeb\Download\" &
Session.SessionID.ToString & ".pdf"
crDiskFileDestinationOptions = New DiskFileDestinationOptions()
crExportOptions = crReportDocument.ExportOptions
With crExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
End With
Try
crReportDocument.Export() ' <-----Error Occured Here
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(Fname)
Response.Flush()
Response.Close()
System.IO.File.Delete(Fname)
Catch err As Exception
Response.Write("<BR><BR>")
Response.Write(err.Message.ToString)
Response.Write("<BR><BR>")
Response.Write(err.StackTrace.ToString)
End Try
I exhausted all method that i know of and still don't know what is wrong.
anyone can help me out with this ?
Any help is very much appreciated.
--
Bernard Goh
IT Administrator
Success Electronics & Transformer Manufacturer Sdn Bhd
No.5 & 7,Jalan TSB 8
Taman Industri Sg. Buloh
47000 Sg.Buloh
Selangor Darul Ehsan