Matt Refghi
Matt Refghi

Reputation: 801

Why do I get a "Failed to export the report" error when I try to export a Crystal Report to an HTML file?

I'm trying to export a Crystal Report to an HTML file, but when I call the Export method, I immediately get this error:

Source: Crystal Reports ActiveX Designer

Description: Failed to export the report.

I have tried both crEFTHTML40 and crEFTHTML32Standard as export format types - and both result in the same error.

Here is a highly simplified version of what I'm doing:

Dim objCRReport As CRAXDRT.Report
[...]
objCRReport.ExportOptions.FormatType = 32 'crEFTHTML40
objCRReport.ExportOptions.DestinationType = 1 'crEDTDiskFile
objCRReport.ExportOptions.DiskFileName = "C:\reportInHtmlFormat.html"
objCRReport.Export False '<--- "Failed to export the report" error here

Please note that I am referencing the "Crystal Reports 9 ActiveX Designer Runtime Library" specifically.

Upvotes: 0

Views: 7551

Answers (3)

Bhuwan pandey
Bhuwan pandey

Reputation: 53

I know the post is old but i faced the same issue and i was too frustrated. i checked directory permissions, debugged the code and what not. but the real issue was on the report itself. i tried exporting the data from CR itself and faced the same error and it was then when i figured out the report itself had some issue. And to be exact, the issue was on report's footer image. i suppressed the report footer (along with the image ofcourse) and voila !!! it worked like a charm.

Upvotes: 0

ANeto
ANeto

Reputation: 1

Try setting the HTMLFileName option instead:

objCRReport.ExportOptions.HTMLFileName = "C:\reportInHtmlFormat.html"

Upvotes: 0

user35193
user35193

Reputation: 54

I'm not sure what you have in the [...] section but your code should include a call to open the report with an instance of the CRAXDRT Application.

Dim objCRReport As CRAXDRT.Report

'***********************************
Dim objCRApp As New CRAXDRT.Application

objCRReport = objCRApp.OpenReport("<YOUR REPORT FILENAME>", 1)
'***********************************

[...]
objCRReport.ExportOptions.FormatType = 32 'crEFTHTML40
objCRReport.ExportOptions.DestinationType = 1 'crEDTDiskFile
objCRReport.ExportOptions.DiskFileName = "C:\reportInHtmlFormat.html"
objCRReport.Export False '<--- "Failed to export the report" error here

Upvotes: 1

Related Questions