General information
Category:
Third party products
the following code works. not perfect. there are some things i still need tow work out. this does not show how to print or send to preview tho. sorry for the incompleteness. hope it helps - see some of my notes in here too.
* Create the CR Object
loCr = CREATEOBJECT("CrystalRuntime.Application")
* Open the report (whatever you created in crystal)
loCrRpt = loCr.OpenReport("c:\my documents\Report.rpt")
* Set the data location (not sure why they do this - i have some trouble here)
loCrData = loCrRpt.Database
loCrTables = loCrData.Tables
loCrTables.Item(1).Location = "c:\xxxx.dbf
* Set the export options
loExportOptions = loCrRpt.ExportOptions
loExportOptions.DestinationType = 1 && crEDTDiskFile
* pdf output
loExportOptions.FormatType = 31
loExportOptions.DiskFileName = "c:\my documents\test.pdf"
loCrRpt.DiscardSavedData()
loCrRpt.Export(.F.)
* excel output
loExportOptions.FormatType = 29 && crEFTExcel80
loExportOptions.DiskFileName = "c:\my documents\test.xls"
loCrRpt.DiscardSavedData()
loCrRpt.Export(.F.)
* plain text file output
loExportOptions.FormatType = 8
loExportOptions.DiskFileName = "c:\my documents\test.txt"
loCrRpt.DiscardSavedData()
loCrRpt.Export(.F.)
* html - doesn't work yet - not sure about "22"
loExportOptions.FormatType = 22
loExportOptions.DiskFileName = "c:\my documents\test.html"
loCrRpt.DiscardSavedData()
loCrRpt.Export(.F.)
* Manual garbage collection
loExportOptions = NULL
loCrTables = NULL
loCrData = NULL
loCrRpt = NULL
loCr = NULL
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only