Export from crystal report to pdf

G

Guest

I am trying to export crystal report to pdf. but i am getting folloing error: "Error in File C:\DOCUME~1\MKM-BA~1\ASPNET\LOCALS~1\Temp\temp_0c6b2c59-df8a-4b26-a570-a2189ee212ac.rpt: Access to report file denied. Another program may be using it."

It works with other reports but not this one.

Code using for export:
Dim myExportOptions As CrystalDecisions.Shared.ExportOptions
Dim myDiskFileDestinationOptions As CrystalDecisions.Shared.DiskFileDestinationOptions
Dim myExportFile As String

myExportFile = "c:\inetpub\wwwroot\" & Session.SessionID.ToString & ".pdf"
myDiskFileDestinationOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions
myDiskFileDestinationOptions.DiskFileName = myExportFile
myExportOptions = crystalReport31.ExportOptions
With myExportOptions
.DestinationOptions = myDiskFileDestinationOptions
.ExportDestinationType = .ExportDestinationType.DiskFile
.ExportFormatType = .ExportFormatType.PortableDocFormat
End With
crystalReport31.Export()

Thanks in advance
Mandar
 
C

Craig Deelsnyder

I am trying to export crystal report to pdf. but i am getting folloing error: "Error in File C:\DOCUME~1\MKM-BA~1\ASPNET\LOCALS~1\Temp\temp_0c6b2c59-df8a-4b26-a570-a2189ee212ac.rpt: Access to report file denied. Another program may be using it."

It works with other reports but not this one.

Code using for export:
Dim myExportOptions As CrystalDecisions.Shared.ExportOptions
Dim myDiskFileDestinationOptions As CrystalDecisions.Shared.DiskFileDestinationOptions
Dim myExportFile As String

myExportFile = "c:\inetpub\wwwroot\" & Session.SessionID.ToString & ".pdf"
myDiskFileDestinationOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions
myDiskFileDestinationOptions.DiskFileName = myExportFile
myExportOptions = crystalReport31.ExportOptions
With myExportOptions
.DestinationOptions = myDiskFileDestinationOptions
.ExportDestinationType = .ExportDestinationType.DiskFile
.ExportFormatType = .ExportFormatType.PortableDocFormat
End With
crystalReport31.Export()

Thanks in advance
Mandar

When you load the report (crystalReport31.Load(..)), there's an overload
for that method, that has a parameter to indicate how to open the report:

http://msdn.microsoft.com/library/d...tml/crlrfopenreportmethodenumerationtopic.asp

if you use the temp copy option, it should not lock the report when you
open it, which is what I think is happening.
 
C

Craig Deelsnyder

Thanks Craig for reply
by default it opens as temporary copy.
it does not give any error if i try word document instead of pdf.
i m not using load() anywhere
Regards

:

sorry, that's all I had; it's been awhile since I've done CR, and I
thought this fixed my problem like this back then. I didn't notice by
default that was set. You might try the CR forums at http://asp.net or
the CR developer zone at:

http://www.businessobjects.com/products/dev_zone/
 
S

Steven Cheng[MSFT]

Hi Mandar,

In addition to Craig's suggestion. You can also ask the Crystal Report
service support through the guides in the following kb article:

#How To Get Help with Crystal Reports - International and U.S.
http://support.microsoft.com/?id=100368

Thanks.


Thanks.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
A

Andrew

3 steps cleared this up for me.

1) You need to set in InetMgr the folder you are exporting to to be Write
enabled.
2) Also in InetMgr, under the porperties for your export folder, you need to
set the Application Pool setting to: MSSharePointAppPool.
3) And finally, you need to set, under Windows Explorer, the security level
for the export folder to Everyone=Full Control.

This should clear you up....did for me when I had this *exact* same problem.

But don't take just my word for it:
http://dotnetjunkies.com/WebLog/richard.dudley/archive/2004/05/24/14362.aspx

-- Andrew


Mandar said:
I am trying to export crystal report to pdf. but i am getting folloing
error: "Error in File
C:\DOCUME~1\MKM-BA~1\ASPNET\LOCALS~1\Temp\temp_0c6b2c59-df8a-4b26-a570-a2189
ee212ac.rpt: Access to report file denied. Another program may be using it."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top