2008-10-30 75 views
0

我试图水晶报表导出为HTML文件,但是当我喊出口的方法,我立即得到这个错误:当我尝试将Crystal Report导出到HTML文件时,为什么会出现“导出报告失败”错误?

Source: Crystal Reports ActiveX Designer

Description: Failed to export the report.

我曾经尝试都crEFTHTML40和crEFTHTML32Standard作为导出格式类型 - 和两者都会导致相同的错误。

下面是我在做什么一个高度简化的版本:

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 

请注意,我引用了“水晶报表9 ActiveX设计运行时库”专。

回答

1

我不确定[...]部分中有什么,但是您的代码应该包含调用以打开包含CRAXDRT应用程序实例的报告。

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 
+0

感谢。不幸的是,我不再处理这段代码(我们不再使用Crystal来做这件事)。我最终会回到旧代码尝试你所描述的,但暂时你得到一个+1您answer.At那个时候,如果我确定它是解决方案,我将其标记为答案。 – 2008-11-10 16:23:20

0

尝试将HTMLFileName选项,而不是:

objCRReport.ExportOptions.HTMLFileName = "C:\reportInHtmlFormat.html" 
相关问题