on 10-11-2011 4:25 PM
I just converted our code from using an older Crystal Reports API for creating PDFs and print jobs (ExportToDisk() and PrintToPrinter()) to using the RAS methods. Now, when calling PrintOutputController::ExportEx(), occassionally the code generates an exception.
Our log file contains the following lines:
calling ExportEx()...
ERROR: caught Exception in CreateReport():
name: COMException
message: The system cannot find the path specified.
creating new ReportDocument
loading template: d:
dev
sources
video
nextlink
Reports
singlemeeting.rpt... done
sleeping for 5 seconds...
retrying export/print...
exporting to:
mako\export\confirmations
1138551.pdf...
entering createPDF():
mako\export\confirmations
1138551.pdf...
calling ExportEx()...
ERROR: caught Exception in CreateReport():
name: CrystalReportsException
message: The report filename was empty.
Here's the snippet of code that is occassionally generating the exception:
void
NReportFaxServiceImpl::createPDF(
ReportDocument^ rpt,
String^ destinationString)
...", destinationString);
CrystalDecisions::ReportAppServer::ReportDefModel::ExportOptions^ exportOpts(gcnew CrystalDecisions::ReportAppServer::ReportDefModel::ExportOptions());
// Set the ExportFormatType to PDF...
exportOpts->ExportFormatType = CrystalDecisions::ReportAppServer::ReportDefModel::CrReportExportFormatEnum::crReportExportFormatPDF;
Console::Write(" calling ExportEx()...");
// This creates the report as a ByteArray that we will write to disk.
CrystalDecisions::ReportAppServer::CommonObjectModel::ByteArray ^ byteArray = rpt->ReportClientDocument->PrintOutputController->ExportEx(exportOpts);
Console::WriteLine("done.");
cli::array<unsigned char, 1>^ oByte = byteArray->DetachArray();
// Create the File...
Console::Write(" creating the PDF file...");
System::IO::File::Create(destinationString, Convert::ToInt32(oByte->Length))->Close();
Console::Write("writing the PDF file...");
System::IO::File::OpenWrite(destinationString)->Write(oByte, 0, Convert::ToInt32(oByte->Length));
Console::Write("calling SetAttributes()...");
System::IO::File::SetAttributes(destinationString, System::IO::FileAttributes::Directory);
Console::WriteLine("done");
GC::Collect();
}
We're running Crystal Reports 2008 SP4 on a Windows 2003 server (virtual server).
The only thing I can suggest is to try to add some additional logging to your application to see if you can see a pattern of which report/parameters are being used when this error is thrown.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.