lisa

lisa

  • NA
  • 1
  • 0

Exporting to HTML using Crystal Reports

Oct 21 2005 12:37 PM

I am exporting my report to an html file using Crystal Reports.  I'm using the following code:

HTMLFormatOptions htmlOpts = new HTMLFormatOptions();
htmlOpts.HTMLBaseFolderName = @"C:\Temp\";
htmlOpts.HTMLFileName = "MyTest.html";
crResults.ExportOptions.FormatOptions = htmlOpts;

crResults.ExportOptions.ExportFormatType = ExportFormatType.HTML40;
crResults.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;

DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
// This line appears to be optional since I've declared a path above:
diskOpts.DiskFileName = @"C:\Temp\MyTest.html"; 
 
crResults.ExportOptions.DestinationOptions = diskOpts;
crResults.Export();

My file ends up in a strangely named temp folder (for example, temp_187cb3f0-60bf-4ea7-a0f7-651a1bb0feb3) which gets created in C:\Temp.  Also, it ends up having a .htm extension instead of .html.  How can I avoid having this extra folder created, and how can I get the correct extension?  Any help is appreciated!

Thanks, LRA


Answers (1)