(the information in this FAQ applies to version 8 of Seagate Crystal Reports, but may apply to other versions as well)
With just a few lines of code you can run, print, or export a Crystal Reports report that you have already designed. If you have already designed and tested the report within CR, you can use the following techiques to invoke the report:
Export a report in Word format
[tt]oCRApp = createobject("crystal.crpe.application")
oRep = oCRApp.OpenReport("C:\MYREPORT.RPT")
oRep.ExportOptions.FormatType = 14 && Word
oRep.ExportOptions.DiskFileName = "c:\test.doc"
oRep.ExportOptions.DestinationType = 1 && disk file
oRep.Export(.F.) && .F. = no dialog box
release oRep
release oCRApp[/tt]
In the above example, use FormatType 4 for RTF, 27 or 28 for Excel 7, 29 or 30 for Excel 8.
Print a report to the default printer
[tt]oCRApp = createobject("crystal.crpe.application")
oRep = oCRApp.OpenReport("C:\MYREPORT.RPT")
oRep.Printout(.F.) && .F. = no printer dialog[/tt]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.