Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal XI (11) Developr failed to export to HTML (error -2147190908) 1

Status
Not open for further replies.

ChristianWhite

Programmer
Jun 14, 2004
41
US
I've written an automatic exporter in VB 6 that works great for exporting Crystal reports to PDF and Excel en masse.

However, using almost identical code for HTML and--that not working--experimenting with various export options, I consistently get error -2147190908: Failed to export the report.

I get the same error whether I set ExportOptions to HTML 3.2 or HTML 4.0. I see the same error whether I try to export a report with a chart or without.

The reports are simple, about 50k, and one-page.

Business Objects--at top of page three of


--suggests -2147190908 is an error with the destination format, or the exported format cannot fit the target format
(such as a report too big for an Excel spreadsheet). With the reports so simple, I doubt the cause is either. Just to check, I stripped a report down to a couple of field--no charts or even details, just a report header with title and print date--and ran the exporter: Same result--the exporter whips out PDF and XLS files, but errors trying to make HTML versions of the same reports.

Business Objects acknowledged the error in 8.5 and 9--but not 10--with a paper on their own site. They have even changed error messaging to be more descriptive, "Failed to create report" indicating an error with the target format. I would think the old cause of the error would have been fixed, and the error must be with my destination--but I can't imagine how these uncomplicated reports would cause an error.

This fellow says he can change the report.export (true/false) command from false to true--which prompts the user--and get his Crystal-8.5-to-HTML export:


It works for, me, too--but since it takes a half-dozen clicks for each of 60 reports, this option isn't acceptable. The idea was to AUTOMATE this big batch job to run at crunch time.

This article for RDC 9 lists files to have in the folder at C:\Program Files\Common Files\Business Objects\3.0\bin:

From that list--even though it's for an old version of Crystal and might not be relevant--I guessed I was lacking gdiplus.dll. Now that I've obtained it and put it in the
C:\Program Files\Common Files\Business Objects\3.0\bin
folder, I get exactly the same result--so I tried to register gdiplus.dll, but the entry point was not found and Windows insisted the file could not be registered.

So, I have a recently-obtained dll--I don't know whether it's registered or not; and my program has behaved exactly
the same all through debugging: It will export XLS and PDF, but not HTML.

Can anyone offer insight into this problem?
What problems might my simple reports have with their HTML destination format?
How might I tell whether gdiplus.dll is registered or not?

Any insight greatly appreciated !

Christian







Here's the launching routine:


Private Sub ExportReportToFile(strFileName As String, strFormat As String)

On Error GoTo ErrorBox
With Report.ExportOptions

Select Case LCase(strFormat)
Case "pdf"
.PDFExportAllPages = True
.FormatType = crEFTPortableDocFormat
Case "xls"
.ExcelExportAllPages = True
.FormatType = crEFTExcel97
Case "html"
.HTMLEnableSeparatedPages = False
.FormatType = crEFTHTML32Standard
Case Else
LogError "modGeneral", "ExportReportToFile--unrecognized format requested", Err.Number, Err.Description
End Select

.DestinationType = crEDTDiskFile
.DiskFileName = strTargetDirectory & "\" & rsPublishers.Fields("Publisher") & "\" & strFileName & "." & strFormat

'note: I have also tried .HTMLFileName for the html files;
' results are the same.

End With
Report.Export (False)


Exit Sub

ErrorBox:
strStyle = vbOKOnly + vbExclamation
strTitle = "Error in ExportReportToFile for " & strFormat & " version of " & rsPublishers.Fields("Publisher") & "'s report " & strFileName
strMsg = CStr(Err.Number) & ": " & Err.Description
' MsgBox strMsg, strStyle, strTitle
LogError "modGeneral", strTitle, Err.Number, Err.Description
Err.Clear
End Sub
 
Instead of using DiskFileName for HTML exports, you should use HTMLFileName.

-dave
 
Wow! That worked!

I had indeed used the HTMLFileName before. I thought I had even clearly separated the HTML exports using HTMLFileName from the line specifying DiskFileFormat for the other file formats. But maybe not. Anyway, that's all it took to generate the entire set.

Many thanks !





The revised subprocedure:




Private Sub ExportReportToFile(strFileName As String, strFormat As String)

On Error GoTo ErrorBox
With Report.ExportOptions

Select Case LCase(strFormat)
Case "pdf"
.PDFExportAllPages = True
.FormatType = crEFTPortableDocFormat
.DiskFileName = strTargetDirectory & "\" & rsPublishers.Fields("Publisher") & "\" & strFileName & "." & strFormat
Case "xls"
.ExcelExportAllPages = True
.FormatType = crEFTExcel97
.DiskFileName = strTargetDirectory & "\" & rsPublishers.Fields("Publisher") & "\" & strFileName & "." & strFormat
Case "html"
.HTMLEnableSeparatedPages = False
.FormatType = crEFTHTML32Standard
.HTMLFileName = strTargetDirectory & "\" & rsPublishers.Fields("Publisher") & "\" & strFileName & "." & strFormat
Case Else
LogError "modGeneral", "ExportReportToFile--unrecognized format requested", Err.Number, Err.Description
End Select

.DestinationType = crEDTDiskFile

End With
Report.Export False


Exit Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top