我需要读取两个rpt文件,并将其存储到excel和mysql数据库中。另外,我需要通过引用两个文件中的唯一列来创建一个报告,该报告是两个rpt文件联接的结果。我之前已经阅读过Excel,Exported Excel和Exported pdf,但是这次我什至不知道如何开始。我尝试使用Google搜索,发现以下解决方案,但将rpt转换为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;
上面的代码也在寻找一个COM组件:CrystalReports10.ObjectFactory.1
我需要将此应用程序部署在Linux服务器上,因此不确定该COM组件是否在那里可用。 请告诉我如何使用Codeigniter读取rpt并将数据存储到数据库和Excel中。