Discussion:
Exporting Crystal Report to PDF at runtime in VB6
(too old to reply)
w***@gmail.com
2005-05-12 14:02:34 UTC
Permalink
I'm trying to use the Crystal Automation Server in Visual Basic 6 to
export a report to PDF, but when I try to set the Format Type,
PortableDoc isn't an option. If I look at my Technical documentation on
the Automation Server, it doesn't have PortableDoc as one of the
options listed, so it isn't that my copy is messed up. it is simply
missing.

How do I get around this problem. I need to be able to export to pdf so
that the report can be emailed to the appropriate person.

Thanks!
Rayne
Michael B. Johnson
2005-05-12 14:45:07 UTC
Permalink
Post by w***@gmail.com
I'm trying to use the Crystal Automation Server in Visual Basic 6 to
export a report to PDF, but when I try to set the Format Type,
PortableDoc isn't an option. If I look at my Technical documentation on
the Automation Server, it doesn't have PortableDoc as one of the
options listed, so it isn't that my copy is messed up. it is simply
missing.
How do I get around this problem. I need to be able to export to pdf so
that the report can be emailed to the appropriate person.
First, you have to get your project references right:

' Reference=*\G{B4741C00-45A6-11D1-ABEC-00A0C9274B91}#8.5#0#C:\Program
' Files\Seagate Software\Report Designer Component\craxdrt.dll#Crystal Reports
' 8.5 ActiveX Designer Run Time Library

See if you can connect the dots on this:

'>> Initialize Crystal Resources
170 Set oCrystalApplication = New CRAXDRT.Application
180 Set oCrystalReport = oCrystalApplication.OpenReport(sMainReportName)

'>> Retrieve data and put it in the Crystal Report
190 Set rs = mcnActiveConnection.Execute(sSQL)
200 Call Crystal_AssignReportDataSource(oCrystalReport, rs)
'...

'>> Use Crystal to export to Adobe PDF format
320 With oCrystalReport
330 .DiscardSavedData
340 .ReadRecords
350 Call Crystal_RunExportToFile(oCrystalReport, crEFTPortableDocFormat,
sTargetPDFPath)
360 End With
'>> Assert: Complete

'...
Public Sub Crystal_RunExportToFile(oReport As CRAXDRT.Report, lFormatType As
CRExportFormatType, sTargetPath As String)
'...
With oReport.ExportOptions
.DiskFileName = sTargetPath
.HTMLFileName = sTargetPath
.FormatType = lFormatType
.PDFExportAllPages = True
.DestinationType = crEDTDiskFile
End With
'...

Hope this sparks some ideas.
_______________________
Michael B. Johnson

Loading...