1

I have two rpt files which I need to read, store into excel and mysql database. Also, I need to create a report that is the result of a join on two rpt files by referring to a unique column common in both of them. I have read Excel, Exported Excel and Exported pdf before but this time I have no idea how to even start. I tried googling and found the following solution but it converts rpt to pdf:

//- Variables - for your RPT and PDF 
//echo "Print Report Test"; 
$my_report = "D:\\Program Fiels\\xampp\\htdocs\\RPT\\RPT-list.rpt"; // 
//rpt source file 
$my_pdf = "D:\\Program Fiels\\xampp\\htdocs\\RPT\\RPT-list.pdf"; // RPT export to pdf file 
//-Create new COM object-depends on your Crystal Report version 
$ObjectFactory= new COM("CrystalReports10.ObjectFactory.1") or die ("Error on load"); // call COM port 
$crapp = $ObjectFactory-> CreateObject("CrystalRuntime.Application.10"); // 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("servername", "username", "password", "databasename"); 
//- field prompt or else report will hang - to get through 
$creport->EnableParameterPrompting = 0; 

//- DiscardSavedData - to refresh then read records 
$creport->DiscardSavedData; 
$creport->ReadRecords(); 


//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;

Also the above code is looking for a COM component: CrystalReports10.ObjectFactory.1

I need to deploy this application on a Linux server so I am not sure whether this COM component will be available there or not. Kindly tell me how can I read rpt using Codeigniter and store data into database and excel.

ITSagar
  • 673
  • 2
  • 10
  • 29

0 Answers0