Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Call a Crystal Report
Message
From
28/11/2001 23:22:31
 
 
To
28/11/2001 09:16:10
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
00586914
Message ID:
00587327
Views:
19
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
Map
View

Click here to load this message in the networking platform