简体   繁体   English

尝试将Crystal报表导出到HTML文件时,为什么会出现“无法导出报表”错误?

[英]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: 我正在尝试将Crystal Report导出到HTML文件,但是当我调用Export方法时,我立即收到此错误:

Source : Crystal Reports ActiveX Designer 资料来源 :Crystal Reports ActiveX设计器

Description : Failed to export the report. 说明 :无法导出报告。

I have tried both crEFTHTML40 and crEFTHTML32Standard as export format types - and both result in the same error. 我已经尝试将crEFTHTML40和crEFTHTML32Standard用作导出格式类型-两者都导致相同的错误。

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. 请注意,我专门引用了“ Crystal Reports 9 ActiveX Designer运行时库”。

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. 我不确定您在[...]部分中拥有什么,但是您的代码应包括调用以使用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

尝试改为设置HTMLFileName选项:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM