当我尝试将Crystal报表导出为HTML文件时,为什么会出现“导出报表失败”错误?

时间:2008-10-30 16:05:54

标签: html vb6 crystal-reports export

我正在尝试将Crystal Report导出为HTML文件,但是当我调用Export方法时,我立即收到此错误:

  

来源:Crystal Reports ActiveX Designer

     

说明:无法导出报告。

我已尝试将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

请注意,我特别引用了“Crystal Reports 9 ActiveX Designer运行时库”。

2 个答案:

答案 0 :(得分: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

答案 1 :(得分:0)

请尝试设置HTMLFileName选项:

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