note 62721 deleted from ref.com by danbrown
| From: | danbrown@php.net | Date: | Mon, 21 Dec 2009 17:07:05 +0000 |
| Subject: | note 62721 deleted from ref.com by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-164202@lists.php.net to get a copy of this message | ||
Note Submitter: M.F.
----
I couldn't find much on Crystal Reports and COM's when I went to tackle it
so I thought a few lines of code here may help out anyone looking for where
to get started in the future.
$crapp = new COM("CrystalRuntime.Application.10");
$creport = $crapp->OpenReport($reportToRun, 1);
//reportToRun=full path to *.rpt file
$creport->Database->Tables->
Item(1)->ConnectionProperties['User ID'] = $user;
$creport->Database->Tables->
Item(1)->ConnectionProperties['Password'] = $pass;
//fomatType = integer 22=xls, 31=pdf etc
$creport->ExportOptions->FormatType = $formatType;
//type 1 is to output to a file I think 2 is email
$creport->ExportOptions->DestinationType = 1;
//location = full path to report output file
$creport->ExportOptions->DiskFileName = $location;
$creport->DiscardSavedData();
$creport->Export(False);