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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

export a reports into html

Status
Not open for further replies.

albab

Programmer
Jul 29, 2001
7
MY
I'm using CrystalReport8 and VisualBasic5
and the "CRPEAuto" to export a report into html format,it actually export the report but just several lines of words.
I use the export option

Set objApp = CreateObject("Crystal.CRPE.Application")
Set objRpt = objApp.OpenReport(test.rpt)
Set objExp = objRpt.ExportOptions

objExp.DiskFileName = "c:\test\test.html"
objExp.HTMLFileName = "test.html"
objExp.DestinationType = 1
objExp.FormatType = 3

do you think my export option missing something?
need help.
thank's
 
Hi,

I recommend using Crystal Report Print Engine for exporting RPT file to any format i.e. HTML, Word, Excel using following API calls.

Private Sub ExportReport()

Dim Result As Integer
Dim MainJob As Integer

' Declare export formatting variables
Dim FormatDLLName As String
Dim formatType As Long
Dim UseSameNumberFormat As Integer
Dim UseSameDateFormat As Integer
Dim StringDelimiter As String
Dim FieldDelimiter As String
Dim ReportFile As String
Dim RetCode As Integer
Dim ReportDir As String


ReportDir = App.Path & "\Reports"

' Open the Crystal Print Engine
Result = PEOpenEngine()

' Open a report (or print job). Set the job id to MainJob
' You will need to modify the argument according to the path
' to your source RPT file


MainJob = PEOpenPrintJob(FileTransferInDir & "\CrptFile.rpt" & vbNullChar)

' Set the exporting DLL name (FormatDLLName) and exporting
' format type (FormatType) to Rich Text Format
FormatDLLName = "uxfwordw.dll" ' Crystal RTF Exporting DLL
formatType = crUXFWordWinType% ' format type constant taken from BAS file



' Initialize UseSameNumberFormat and UseSameDateFormat to 0 (False)
' (not used in RTF exporting)
UseSameNumberFormat = 0
UseSameDateFormat = 0

' Initialize StringDelimiter and FieldDelimiter to empty strings.
' Only used for the character separated values exporting format
StringDelimiter = ""
FieldDelimiter = ""

' Set the exporting to disk using crPEExportToDisk
' You will need to modify the 2nd argument according to where you want
' to write the exported file.
Result = crPEExportToDisk(MainJob, FileTransferOutDir & "\ExportedFile.doc" & vbNullChar, _
FormatDLLName & vbNullChar, formatType, UseSameNumberFormat, _
UseSameDateFormat, StringDelimiter & vbNullChar, FieldDelimiter & _
vbNullChar)

' Start the print job (commences exporting)
Result = PEStartPrintJob(MainJob, 1)

' Close the print job
PEClosePrintJob (MainJob)

' Close the Crystal Print Engine
PECloseEngine


End Sub




 
thank's vec,
I`m sure that your code will be useful for me and others.
Before receiving your post,I`ve change my programming to RDC and it`s work.I notice that CR8 do not support when exporting to html format if using automation server(CRPEAuto),it work in CR7.
keep in tuch Vec.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top