Skip to Content
Former Member
Jul 17, 2009 at 03:59 PM

Emailing Crystal Report in email body as HTML


I'm having a problem sending emails in CR 2008 when the report is displayed as HTML in the body of the email.

This code works in my development environment but it doesn't work in the testing environment when CR 2008 is installed using a .msi with CR merge modules:

ExportOptions crExportOptions = new ExportOptions();
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.HTML40;

HTMLFormatOptions htmlOpts = ExportOptions.CreateHTMLFormatOptions();
htmlOpts.HTMLBaseFolderName = tempPath;
htmlOpts.HTMLFileName = fileName;
htmlOpts.HTMLEnableSeparatedPages = false;
htmlOpts.HTMLHasPageNavigator = false;
htmlOpts.UsePageRange = false;
crExportOptions.ExportFormatOptions = htmlOpts;


using (StreamReader r = File.OpenText(tempPath + "\\" + Path.GetFileNameWithoutExtension(_template.TemplateName) + "\\" + fileName))
	html = r.ReadToEnd();

When _reportDocument.Export(crExportOptions) is called this error is thrown:

Invalid export options.

I'm I doing something wrong with code, or do I need to do change something in my testing environment to get this to work?

Testing Environment:

Windows 2003 Server

2008 CR SP1 Merge Modules

.Net 3.5 SP1

Thanks in advance,