cancel
Showing results for 
Search instead for 
Did you mean: 

CrystalDecisions.CrystalReports.Engine.ReportDocument.Export(ExportOptions options) Throwing Exception

Former Member
0 Kudos

Works on Development box. Windows 7 64bit.

Not working on Deployed Server 2012 R2 64bit

Crystal Reports version 13_0_13.

2015-06-08 11:21:25,692 [7] FATAL DecalPrintWCWindowsService.clsDecal [(null)] - CreateDecalPDF:
System.Runtime.InteropServices.COMException (0x80004005): The system cannot find the path specified.

   at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)
   at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
   at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
   at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.Export(ExportOptions options)
   at DecalPrintWCWindowsService.clsDecal.CreateDecalPDF()

Code Snippet:

                ReportDocument objCR_ReportDoc = new ReportDocument();
                DiskFileDestinationOptions objDiskFileDestinationOptions;
                ExportOptions objExportOptions;

                objCR_ReportDoc.Load(sTemplatePath);

                objDiskFileDestinationOptions = new DiskFileDestinationOptions();
                objExportOptions = objCR_ReportDoc.ExportOptions;
                objExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                objExportOptions.ExportFormatOptions = null;
                objExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
                objDiskFileDestinationOptions.DiskFileName = msPDFPath + PDFFileName;
                WriteLine(msPDFPath + PDFFileName);
                objExportOptions.ExportDestinationOptions = objDiskFileDestinationOptions;
                objCR_ReportDoc.Export(objExportOptions);
                objCR_ReportDoc.Dispose();

It is exploding (throwing exception) at the second to last line... objCR_ReportDoc.Export(objExportOptions);

I have been researching this issue for several days, tried most all suggestions from this site and others, to no avail.

Any thoughts?

John

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi John,

             I find myself in a similar predicament, but my case is a web application using the latest Crystal report dll. the culprit is the CR report dll.


The error am getting;


System.MissingMethodException: Method not found: 'CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag CrystalDecisions.ReportAppServer.ReportDefModel.ISCRExportOptions.get_ExportOptionsEx()'

that's why your application is not working. This is a major issue for me. I pray it is resolved soonest. The dll is missing a critical method to export the generated document

Hakeem

0 Kudos

Hi Guys,

An exception is going to be thrown if the report does not have that export option saved in it.

So simply use a try/catch block and the collection is Null then it means the saved export options have not been saved in the RPT.

Like so...

CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions RASexportOpts = new CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions();
CrystalDecisions.ReportAppServer.ReportDefModel.CharacterSeparatedValuesExportFormatOptions RasCSVExptOpts = new CharacterSeparatedValuesExportFormatOptions();
CrystalDecisions.ReportAppServer.ReportDefModel.DataOnlyExcelExportFormatOptions RasExcelDataOnlyExpOpts = new DataOnlyExcelExportFormatOptions();
CrystalDecisions.ReportAppServer.ReportDefModel.EditableRTFExportFormatOptions RasEditRTFExpOpts = new CrystalDecisions.ReportAppServer.ReportDefModel.EditableRTFExportFormatOptions();
CrystalDecisions.ReportAppServer.ReportDefModel.ExcelExportFormatOptions RasXLSExpOpts = new ExcelExportFormatOptions();

CrystalDecisions.ReportAppServer.ReportDefModel.PaginatedTextExportFormatOptions RasPaginTextExpOpts = new PaginatedTextExportFormatOptions();
CrystalDecisions.ReportAppServer.ReportDefModel.PDFExportFormatOptions RasPDFExpOpts = new PDFExportFormatOptions();
CrystalDecisions.ReportAppServer.ReportDefModel.RPTExportFormatOptions RasRPTExpOpts = new RPTExportFormatOptions();
CrystalDecisions.ReportAppServer.ReportDefModel.RTFWordExportFormatOptions RasRTFWordExpOpts = new RTFWordExportFormatOptions();
CrystalDecisions.ReportAppServer.ReportDefModel.TextExportFormatOptions RastxtExpOpts = new TextExportFormatOptions();
CrystalDecisions.ReportAppServer.ReportDefModel.XMLExportFormatOptions RasXMLExpOpts = new XMLExportFormatOptions();
CrystalDecisions.ReportAppServer.ReportDefModel.IndentAndSpacingFormat RasIndentSpaceExpOpts = new IndentAndSpacingFormat();

string textBox1 = String.Empty;
string MyObjectType = ReportObjectComboBox1.SelectedItem.ToString();
btnReportObjects.Text = "";

foreach (CrystalDecisions.ReportAppServer.ReportDefModel.CrReportExportFormatEnum SavedExpType in valArray1)
{
    switch (SavedExpType.ToString())
    {
        case "crReportExportFormatCrystalReports":
            try
            {  
                RasRPTExpOpts = rptClientDoc.get_SavedExportOptions(CrReportExportFormatEnum.crReportExportFormatReportDef);
                textBox1 = "RPT Format: \n";
                textBox1 += "DiscardUnselectedRecords: " + RasRPTExpOpts.DiscardUnselectedRecords.ToString() + "\n";
                textBox1 += "BaseAreaGroupNumber:       " + RasRPTExpOpts.EndPageNumber.ToString() + "\n";
                textBox1 += "BaseAreaType:              " + RasRPTExpOpts.StartPageNumber.ToString() + "\n";
            }
            catch (Exception ex)
            {
                textBox1 = "RPT Format Options - Not saved\n";
                btnReportObjects.Text += textBox1;
                btnReportObjects.AppendText(" 'End' \n\n");
                textBox1 = "";
                break;
            }

            btnReportObjects.Text += textBox1;
            btnReportObjects.AppendText(" 'End' \n\n");
            textBox1 = "";
            break;
...

Don

Former Member
0 Kudos

Are you saying that one needs to set export options in a report object before exporting it?

I'm running into the exact same problem - Development VM works fine (both through visual studio and installed/running as a service) but will not process a specific report on a production server.  Both are at 13.0.14 (VM=SDK, server=API Runtime) and the server's API has been reinstalled with reboots.  I would attach my PML but it's over 1MB and you don't allow ZIP files!

ReportDocument report = new ReportDocument();

report.Load(customLocation);

//report.IsLoaded is TRUE

CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions exportOptions = new ExportOptions();

exportOptions.ExportFormatType = CrReportExportFormatEnum.crReportExportFormatCrystalReports;

exportOptions.FormatOptions = new RPTExportFormatOptions();;

//Exporting crashes on a specific report - other reports from "customLocation" work fine and nothing has this specific file locked - even made a copy and tried that.

report.ReportClientDocument.PrintOutputController

    .ExportEx(exportOptions)

    .Save(exportReportPath, true);

System.Runtime.InteropServices.COMException (0x80004005): The system cannot find the path specified. 

    at CrystalDecisions.ReportAppServer.Controllers.PrintOutputControllerClass.ExportEx(ExportOptions exportOptions)

Answers (2)

Answers (2)

Former Member
0 Kudos

Ludek,

Thanks for the response... I have since changed up the environment to crystal 13_0_14. (that did not fix the problem though)

Anyway, I have run ProcMon on both my dev and deployed machines and have reviewed the logfiles for both.

There does not seem to be anything that jumps out at me as a problem. The biggest thing that I notice is that on the system that works, there are entries for the .pdf being manipulated in the directory it is supposed to show up in. In the system that does not work, the entries are missing, kinda like my file.

Dev system entries...

.

.

.

8:22:19.5929430 AM DecalPrintWCWindowsService.exe 6644 CreateFile C:\Windows Service\Watercraft\DecalPrint_WC\PDF SUCCESS Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened

8:22:19.5929670 AM DecalPrintWCWindowsService.exe 6644 QueryNetworkOpenInformationFile C:\Windows Service\Watercraft\DecalPrint_WC\PDF SUCCESS CreationTime: 5/28/2015 10:50:27 AM, LastAccessTime: 6/9/2015 4:08:47 PM, LastWriteTime: 6/9/2015 4:08:47 PM, ChangeTime: 6/9/2015 4:08:47 PM, AllocationSize: 4096, EndOfFile: 4096, FileAttributes: D

8:22:19.5929782 AM DecalPrintWCWindowsService.exe 6644 CloseFile C:\Windows Service\Watercraft\DecalPrint_WC\PDF SUCCESS

8:22:19.5931244 AM DecalPrintWCWindowsService.exe 6644 CreateFile C:\Windows Service\Watercraft\DecalPrint_WC\PDF SUCCESS Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened

8:22:19.5932316 AM DecalPrintWCWindowsService.exe 6644 QueryDirectory C:\Windows Service\Watercraft\DecalPrint_WC\PDF\* SUCCESS Filter: *, 1: .

8:22:19.5932905 AM DecalPrintWCWindowsService.exe 6644 QueryDirectory C:\Windows Service\Watercraft\DecalPrint_WC\PDF SUCCESS 0: .., 1: 2256BT_01_20150609_1430391390.pdf, 2: 2256BT_01_20150609_1459323212.pdf, 3: 2256BT_01_20150609_1608438383.pdf

8:22:19.5933289 AM DecalPrintWCWindowsService.exe 6644 QueryDirectory C:\Windows Service\Watercraft\DecalPrint_WC\PDF NO MORE FILES

8:22:19.5933478 AM DecalPrintWCWindowsService.exe 6644 CloseFile C:\Windows Service\Watercraft\DecalPrint_WC\PDF SUCCESS

8:22:19.5934828 AM DecalPrintWCWindowsService.exe 6644 CreateFile C:\Windows Service\Watercraft\DecalPrint_WC\PDF\2256BT_01_20150609_1430391390.pdf SUCCESS Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened

8:22:19.5935071 AM DecalPrintWCWindowsService.exe 6644 QueryNetworkOpenInformationFile C:\Windows Service\Watercraft\DecalPrint_WC\PDF\2256BT_01_20150609_1430391390.pdf SUCCESS CreationTime: 6/9/2015 2:30:47 PM, LastAccessTime: 6/9/2015 2:30:47 PM, LastWriteTime: 6/9/2015 2:30:47 PM, ChangeTime: 6/9/2015 2:31:29 PM, AllocationSize: 53248, EndOfFile: 53007, FileAttributes: A

8:22:19.5935180 AM DecalPrintWCWindowsService.exe 6644 CloseFile C:\Windows Service\Watercraft\DecalPrint_WC\PDF\2256BT_01_20150609_1430391390.pdf SUCCESS

8:22:19.5936742 AM DecalPrintWCWindowsService.exe 6644 RegQueryKey HKLM SUCCESS Query: HandleTags, HandleTags: 0x0

.

.

.

Deployed server entries...

.

.

.

3:48:19.7256629 PM DecalPrintWCWindowsService.exe 792 CreateFile C:\Windows Service\Watercraft\DecalPrint_WC\PDF SUCCESS Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened

3:48:19.7257271 PM DecalPrintWCWindowsService.exe 792 QueryNetworkOpenInformationFile C:\Windows Service\Watercraft\DecalPrint_WC\PDF SUCCESS CreationTime: 6/4/2015 3:16:37 PM, LastAccessTime: 6/4/2015 3:16:37 PM, LastWriteTime: 6/4/2015 3:11:26 PM, ChangeTime: 6/4/2015 3:16:37 PM, AllocationSize: 0, EndOfFile: 0, FileAttributes: D

3:48:19.7257399 PM DecalPrintWCWindowsService.exe 792 CloseFile C:\Windows Service\Watercraft\DecalPrint_WC\PDF SUCCESS

3:48:19.7259601 PM DecalPrintWCWindowsService.exe 792 CreateFile C:\Windows Service\Watercraft\DecalPrint_WC\PDF SUCCESS Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened

3:48:19.7260828 PM DecalPrintWCWindowsService.exe 792 QuerySecurityFile C:\Windows Service\Watercraft\DecalPrint_WC\PDF SUCCESS Information: Attribute

3:48:19.7260997 PM DecalPrintWCWindowsService.exe 792 QueryDirectory C:\Windows Service\Watercraft\DecalPrint_WC\PDF\* SUCCESS Filter: *, 1: .

3:48:19.7261772 PM DecalPrintWCWindowsService.exe 792 QueryDirectory C:\Windows Service\Watercraft\DecalPrint_WC\PDF SUCCESS 0: ..

3:48:19.7262029 PM DecalPrintWCWindowsService.exe 792 QueryDirectory C:\Windows Service\Watercraft\DecalPrint_WC\PDF NO MORE FILES

3:48:19.7262183 PM DecalPrintWCWindowsService.exe 792 CloseFile C:\Windows Service\Watercraft\DecalPrint_WC\PDF SUCCESS

3:48:19.7270497 PM DecalPrintWCWindowsService.exe 792 Thread Create  SUCCESS Thread ID: 2772

3:48:19.7273664 PM DecalPrintWCWindowsService.exe 792 Thread Exit  SUCCESS Thread ID: 2772, User Time: 0.0000000, Kernel Time: 0.0000000

.

.

.

Anything else to check?

John

former_member183750
Active Contributor
0 Kudos

Hi John

Probably the best thing to do is throw Process Monitor on it and see what is the path the system cannot find. Make sure to set a filter for the app in procmon as it tends to create pretty massive logs. Once you have the procmon logs look for any errors or Access Denied messages.

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow me on Twitter

Former Member
0 Kudos

Hi Ludek,

I ran ProcMon, output below...

former_member183750
Active Contributor
0 Kudos

Hi John

Nothing really jumps out. There are differences, but hard to say why. If you search for "Access Denied" in the log do you get any hits on that - be it file folders or registry.

What about trying to install on another computer? See if we get the same issue there?

- Ludek

Former Member
0 Kudos

Hi Ludek,

Yes, I have searched for 'ACCESS DENIED', found in both logs, still nothing of note that I can see.

I have had a new VM set up for testing. I will test 'AS-IS' (The app is a Windows Service running as LOCAL SERVICE) and if needed I can put VS2013 on the box and debug it from there, so I will need to tear it down to code pieces that I can execute for testing at which time it will be running under my account, different permissions perhaps, but might shed some light on the issue, then again, it might not.

I can send both logs along for preview by you or someone on your end if you think that might help.

Thanks

John

Former Member
0 Kudos

Hi Ludek,

This is where I am at as of now.

We have set up a VM that is a copy of the deployed server to test on. I was able to set-up and run remote debugging on this new VM.


The program is a Windows Service. It is being run on 'LOCAL SYSTEM' account (not 'LOCAL SERVICE' as I said before, my mistake) this 'should' rule out permission issues.


The program gathers data from an Informix database and creates an XSD file as it should, this works just fine.


The .rpt file exists and is accessible and does not throw an exception on the ReportDocument.Load(...)... method call.

Remote Debugging shows that when we get to the ReportDocument.Export(...)... it throws the exception, as noted before. There is no inner-exception to see.
   The parameters are not null.
   The parameters are set correctly.

I have changed the call to ReportDocument.ExportToDisk(...)... it changed nothing.
I have changed the file type to save, it changed nothing.
I have changed the folder/path in the Export call. I have used forward slashes, changed it to be right off the root of the drive 'C:\PDF\', it changed nothing.
I have tested access to the path by writing a file, to the path, with the same name that Crystal was supposed to use, it works, Crystal does not.
  
I have tried the different deployment types for the Crystal Reports for Visual Studio with the exception of Merge Modules (13_0_14 started with 13_0_13).
Other than the 64 bit, they gave the same results. 64 bit has other issues as you can imagine, as our deployed application is 32 bit.

This is not a new program, it is an uplift of a currently running program / report.

Current running system...
Windows Server 2003 / CrystalReports 2008 Runtime, Crystal Viewer...

This is a business critical piece of Software that really needs the uplift.

Any thoughts? Am I missing something? I will try anything that might be of use.

Is there a way I can escalate this issue?

Thanks much

John

0 Kudos

Hi John,

Did you compile it to be 32 or 64 bit?

Can you run debugdiag (Microsoft) and set it for an exception? It may tell us what API it's failing in. I can get the PDB's for you also if we need them.

How about running your service as in console mode to capture more details?

All of the errors being returned are with Windows Services, have you asked Microsoft what these errors mean?

How about running the Service under the Local PC Admin account?

Don

Former Member
0 Kudos


Hello Don,

Thank you for your response.

> Did you compile it to be 32 or 64 bit?

It is compiled as 32bit.

>Can you run debugdiag (Microsoft) and set it for an exception? It may tell us what API it's failing in. I can get the PDB's for you also if we need them.

PDB's might help in debugging.

I installed and ran debugdiag (as per your suggestion). The output is too much info to post here, but the gist of it is:

***********************
*  EXCEPTION SUMMARY  *
***********************

|--------------------------------------------------------------|
| Count | Exception                                            |
|--------------------------------------------------------------|
| 6     | 0XE06D7363                                           |
| 1     | System.Runtime.InteropServices.COMException          |
| 1     | CrystalDecisions.ReportAppServer.ConvertDotNetToErom |
| 1     | CLR Exception                                        |
|--------------------------------------------------------------|

> How about running your service as in console mode to capture more details?

I am already running in Visual Studio-debug mode via msvsmon and as such can see all lines of code (minus no-source code assemblies such as CR code) execute and inspect all variables as needed. What more could I possibly get out of running the process in console mode? I am not opposed to doing this, I just need a push.

> All of the errors being returned are with Windows Services, have you asked Microsoft what these errors mean?

I have not spoken w/ Microsoft about any of this. I have researched the exception by name and number, as well as looked for information on HResult number and ErrorCode number information found stuffed away in the innards of the exception.

> How about running the Service under the Local PC Admin account?

I am an admin on this development vm. I changed the account information to my credentials, it changed nothing.

Anything more I can look at?

Thanks much

John

0 Kudos

Can you attach your report with saved data, use dummy data of course.

May be something in the report causing the problem. I can run it through my main test app and get more info.

To attach click on the Advance Editor link and rename your report to *.txt first.

Don