note 72955 deleted from ref.com by cmb
| From: | cmb@php.net | Date: | Sun, 30 Jun 2019 07:43:12 +0000 |
| Subject: | note 72955 deleted from ref.com by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211411@lists.php.net to get a copy of this message | ||
Note Submitter: wiliamfeijo at gmail dot com
----
This code use a Crystal Reports file with a connection on
Oracle 9i Database, suports manipulate and refresh data
and export to PDF file:
------ REMEMBER ------
These functions are only available if you had instaled the
Crystal Reports Developer Edition. Catch the trial on the
http://www.businessobjects.com web site.
<?php
//------ Variables ------
$my_report = "C:\\rel_apontamento.rpt";
$my_pdf = "C:\\teste.pdf";
//------ Create a new COM Object of Crytal Reports XI ------
$ObjectFactory= new
COM("CrystalReports11.ObjectFactory.1");
//------ Create a instance of library Application -------
$crapp
=$ObjectFactory->
CreateObject("CrystalDesignRunTime.Application.11");
//------ Open your rpt file ------
$creport = $crapp->OpenReport($my_report, 1);
//------ Connect to Oracle 9i DataBase ------
$crapp->LogOnServer('crdb_oracle.dll','YOUR_TNS',
'YOUR_TABLE','YOUR_LOGIN','YOUR_PASSWORD');
//------ Put the values that you want --------
$creport->RecordSelectionFormula=
"{YOUR_TABLE.FIELD}='ANY_VALUE'";
//------ This is very important. DiscardSavedData make a
Refresh in your data -------
$creport->DiscardSavedData;
//------ Read the records :-P -------
$creport->ReadRecords();
//------ Export to PDF -------
$creport->ExportOptions->DiskFileName=$my_pdf;
$creport->ExportOptions->FormatType=31;
$creport->ExportOptions->DestinationType=1;
$creport->Export(false);
//------ Release the variables
$creport = null;
$crapp = null;
$ObjectFactory = null;
?>
It's functional and perfectly !!!!!!!
Thanks.....