je souhaite générer un rapport avec crystal reports 9 à partir de mon application PHP, mais je reçois l'erreur suivante:
Fatal error: Call to undefined method com::CreateObject() in C:\Program Files\EasyPHP 3\www\checkListISO9001\v3\checkList\resultat.php on line 75
Voici mon code:
<?php
//- Variables - for your RPT and PDF
$my_report = "C:\\Program Files\\EasyPHP 3\\www\\checkListISO9001\\v3\\checkList\\rapportISO.rpt"; //rpt source file
$my_pdf = "C:\\Program Files\\EasyPHP 3\\www\\checkListISO9001\\v3\\checkList\\rapportISO.pdf"; // RPT export to pdf file
//-Create new COM object-depends on your Crystal Report version
$ObjectFactory= new COM("CrystalRuntime.Application.9") or die ("Error on load"); // call COM port
$crapp = $ObjectFactory-> CreateObject("CrystalDesignRunTime.Application"); // create an instance for Crystal
$creport = $crapp->OpenReport($my_report, 1); // call rpt report
// to refresh data before
//- Set database logon info - must have
$creport->Database->Tables(1)->SetLogOnInfo("localhost", "test", "root", "admin");
//- field prompt or else report will hang - to get through
$creport->EnableParameterPrompting = 0;
//- DiscardSavedData - to refresh then read records
$creport->DiscardSavedData;
$creport->ReadRecords();
//------ Pass formula fields --------
$creport->FormulaFields->Item(1)->Text = ("'My Report Title'");
$creport->ParameterFields(1)->AddCurrentValue ("FirstParameter");
$creport->ParameterFields(2)->AddCurrentValue (2000);
//export to PDF process
$creport->ExportOptions->DiskFileName=$my_pdf; //export to pdf
$creport->ExportOptions->PDFExportAllPages=true;
$creport->ExportOptions->DestinationType=1; // export to file
$creport->ExportOptions->FormatType=31; // PDF type
$creport->Export(false);
//------ Release the variables ------
$creport = null;
$crapp = null;
$ObjectFactory = null;
?>
N.B: j'utilise EasyPHP 2.0
Votre aide sera beaucoup appréciée les amis.