cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

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

Former Member
0 Likes
3,452

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

View Entire Topic
0 Likes

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 Likes

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 Likes

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)