Export a Crystal Report to HTML40 file.


Geir Holme

Hi all.
Can anyone help me to find out whats missing in the following code. I am
trying to export a report to a html file.

An unhandled exception of type 'System.Reflection.TargetInvocationException'
occurred in mscorlib.dll
Additional information: Exception has been thrown by the target of an

If I use the ExportFormatType = PortableDocFormat it works great.

And, is there anyway I can put this HTML report directly into a mailbody and
send it out via CDO or something else.

Thanks all


Dim crExportOptions As ExportOptions
Dim crReportDocument = New ReportDocument
Dim crDiskFileDestinationOptions = New DiskFileDestinationOptions
crReportDocument.Load("C:\Documents and Settings\geir\My Documents\Visual
Studio Projects\Tips\CrystalReport3.rpt")
crDiskFileDestinationOptions.DiskFileName = "C:\exportedweb.htm"

crExportOptions = crReportDocument.ExportOptions
With crExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.HTML40
End With

Ying-Shen Yu[MSFT]

Hi Geir,

I'm not familiar with Crystal Report , it is supported by CrystalReport(
www.businessobjects.com), although it's included in VS.NET.

But from the Exception type, it seems it did not give the full exception
message. Did you get this exception message when running with Debugging? If
yes, You may try run your program without debugging (Ctrl+F5) to get the
full error info. Then you may see the innerexception and the error message,
maybe it will give you more information about this problem.


Best regards,

Ying-Shen Yu [MSFT]
Microsoft community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question