Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crystal Reports/Windows 7: Crystal reports asks for a default email client, and posts an error

Crystal Reports 11 (craxdrt.dll 11.5.7.1048) Windows 7

I'm using Crystal Reports to export to a PDF document, using CRYSTALCRAXDRT::IReport::Export, and am getting an error, Windows 7 only.

"There is no email program associated to perform the requested action. Please install an email program or, if one is already installed, create an association in the Default Programs control panel."

Again, I'm not trying to send email, just create a document.

I've put forth a little debugging effort into this, and what seems to be happening is this:

  1. I call into craxdrt.dll via the IReport interface, function Export(...), and then, monitoring with procmon, I find that there are several hundred registry queries for default mailer, contacts, etc.
  2. It would seem that craxdrt.dll is building a large-ish data structure ahead of the task with whatever info it might need for a family of functions.
  3. There's an error posted when the program can't find a default email client

Problems with this:

  1. Windows 7 does not ship with a default email client, and early investigation seems to indicate that installing one does not necessarily ameliorate the problem. In any case, I do not expect all of our clients to have one installed, nor do our clients expect to have one installed by us.
  2. Absent the actual need for an email client (i.e., in the above case), we're still getting this error message pop-up.

Note: Interestingly, this doesn't actually prevent the user from pressing the export button again, and in fact if the user does this, the error does not show up, as the registry queries are apparently done only once per load or use of craxdrt.dll.

like image 401
Benboy Avatar asked Sep 21 '10 18:09

Benboy


1 Answers

I think you are missing setting the ExportOptions before exporting:

Dim crxReport As Report
Set crxReport = Prepare()

crxReport.ExportOptions.FormatType = crEFTPortableDocFormat
crxReport.ExportOptions.DestinationType = crEDTDiskFile
crxReport.ExportOptions.DiskFileName = "C:\temp\Report.PDF"

crxReport.Export (False)
like image 51
Eduardo Molteni Avatar answered Nov 11 '22 04:11

Eduardo Molteni