Environment: VB6 SP5, CR 8.5, Using CRWRAP.BAS and GLOBAL32.BAS
To export a Crystal Report Report Definition to a TXT file for further processing (parsing, extraction of table/field names).
There are over 600 reports to be examined. The program opens the appropriate folder, collects the names of all RPTs, exports each to a TXT file in the same (or different) directory.
Code Snippet (EXPORT):
Handle = PEOpenEngine
If Handle = 0 Then
lbl = "Error opening RPT file"
lbl = "Crystal Print Engine Successfully Open"
job = PEOpenPrintJob(FullName)
exportdll = "u2frdef.dll"
exportformat = 0 'crUXFReportDefinitionType
result = crPEExportToDisk(job, inpDest & FName & ".txt" + Chr(0), "u2frdef.dll" + Chr(0), exportformat, 0, 0, "", "")
If PEStartPrintJob(job, True) = 0 Then
lbl = "Error starting print job"
MsgBox "crPEExportToDisk Failed: " & Str$(PEGetErrorCode(job))
lbl = FullName & " exported"
The proc runs fine returning no errors until PEStartPrintJob(job, True). A Parameter Input window is displayed and, on clearing the window, the proc terminates in an errotr 500. Since the export is of a Report efinition, I cannot understand WHY the DLL requires an ODBC call to the database (no data is being exported) or, if it is imperative an ODBC call be made, how to make it. There is NO example in rystal or on the Web which shows how to handle the crPEExportToDisk function when the type of export is Report Definition.
In order for this program to function correctly, it must access, open, export the Report Definition, closwe, then retrieve another RPT until the file list for the folder is exhausted.
After three days of head-banging, I've come to the conclusion that I cannot export a Report Def without an ODBC call being made, but I have zero idea as to how to make it within this code structure.
Suggestions are gratefully accepted!!