harish has asked for the wisdom of the Perl Monks concerning the following question:
Any help is greatly appreciated.
Harish
use Win32::ODBC; use Win32::OLE; use Win32::OLE::Variant; #### Create the Crystal Report RunTime Instance ###################### +####### $ex = Win32::OLE->new('CrystalRuntime.Application', sub {$_[0]->Quit;} +) or die "Oops, cannot start Crystal"; $oReport = $ex->OpenReport('C:\CrystalParameters\Myreportone.rpt', 1) +; $oReport->{'EnableParameterPrompting'} = 0 ; $oexportoptions = $oReport->{'ExportOptions'} ; $cParameterFields = $oReport->{'ParameterFields'} ; #########Add Default Values################################## ######################################################## $prms = $cParameterFields->Count; for ($x = 1 ; $x <= $prms ; $x++){ $oParameterField = $cParameterFields->Item($x) ; $tmp = $oParameterField->{'ParameterFieldName'} ; $tmp = substr($tmp,1,length($tmp)-1) ; if ($tmp eq "tradedate2"){ $tt = 0 ; $tt = $oParameterField->{'IsCurrentValueSet'} ; if ($tt eq 0) { $oParameterField->ClearCurrentValueAndRange ; $oParameterField->AddCurrentValue("01/31/03") ; } } if ($tmp eq "mode"){ $tt = 0 ; $tt = $oParameterField->{'IsCurrentValueSet'} ; if ($tt eq 0) { $oParameterField->ClearCurrentValueAndRange ; $oParameterField->AddCurrentValue("MONTH") ; } } } # end of the for loop ############################################################ + + #######set the Export Options to Export it to Excel file ############# +##### $oexportoptions->{'FormatType'} = 36 ; $oexportoptions->{'DestinationType'} = 1 ; $oexportoptions->{'DiskFileName'} = 'c:\mytestreportone.xls' ; ####################################################### $oReport->Export(Variant(VT_BOOL, 0));
update (broquaint): added <code> tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) Re: help with passing parameters to a Crystal report in PERL
by jeffa (Bishop) on May 16, 2003 at 15:30 UTC |