General information
Category:
Reports & Report designer
Title:
Crystal 8 and parameters, also xls exports
When I run this code, it prints that current value is set, but prints a blank as its value, and then the report prompts me for the parameter.
on a separate note, when it exports to xls, it leaves blank columns at the beginning in the xls spreadsheet. Can that be fixed?
Any ideas?
Thanks in advance.
* Create the CR Object
loCr = CREATEOBJECT("CrystalRuntime.Application")
* Open the report
loCrRpt = loCr.OpenReport("C:\crystal\top_telephones.Rpt")
* Set the parameters
loCrRpt.EnableParameterPrompting = .F.
loCrRpt.ParameterFields.Item(1).AddCurrentValue("Test Title")
? 'Is Current Value Set'
? loCrRpt.ParameterFields.Item(1).IsCurrentValueSet
? 'Current Value'
? loCrRpt.ParameterFields.Item(1).Value
* Set the data location
loCrData = loCrRpt.Database
loCrTables = loCrData.Tables
loCrTables.Item(1).Location = "c:\crystal\top_telephones.dbf"
* Set the export options
loExportOptions = loCrRpt.ExportOptions
loExportOptions.DestinationType = 1 && crEDTDiskFile
loExportOptions.FormatType = 29 && crEFTExcel80
loExportOptions.DiskFileName = "c:\crystal\top_telephones.xls"
* Export the file
loCrRpt.DiscardSavedData()
loCrRpt.Export(.F.)
* Manual garbage collection
loExportOptions = NULL
loCrTables = NULL
loCrData = NULL
loCrRpt = NULL
loCr = NULL
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