我在哪里可以find一个PHP COM对象库及其所有function?

我一直在互联网上search某些function来操纵一个Excel的COM对象与PHP。 我能够创build一个新的Excel表格并保存数据,但我无法使用样式函数来使报告看起来不错。

以下是我的代码,以防万一:

private $users; private $brdata; private $excel; private $book; private $sheet; private $today; private $columns; public function __construct() { $this->users = $this->model('users'); $this->brdata = $this->model('brdata'); $this->excel = new COM("Excel.Application"); $this->excel->Workbooks->Add(); $this->book = $this->excel->Workbooks(1); $this->sheet = $this->book->Worksheets(1); $this->today = date('Ym-d', strtotime("-1 days")); $this->columns = array("UPC" => "UPC", "VDR ITEM #" => "CertCode", "BRAND" => "Brand", "ITEM DESCRIPTION" => "ItemDescription", "PACK" => "Pack", "SIZE" => "SizeAlpha", "CASE COST" => "CaseCost", "RETAIL" => "Retail", "ON-HAND" => "onhand", "LAST ORDER" => "lastReceiving", "LAST ORDER DATE" => "lastReceivingDate", "SALES" => "sales", "VDR #" => "VdrNo", "VDR NAME" => "VdrName");; } public function index() { $header = array("A" => "UPC", "B" => "VDR ITEM #", "C" => "BRAND", "D" => "ITEM DESCRIPTION", "E" => "PACK", "F" => "SIZE", "G" => "CASE COST", "H" => "RETAIL", "I" => "ON-HAND", "J" => "LAST ORDER", "K" => "LAST ORDER DATE", "L" => "SALES", "M" => "VDR #", "N" => "VDR NAME"); $this->setSheetName("Sheet 1"); $this->setHeader("Example Report", $header); $this->setReport('0035', '2016-07-01', '2016-08-01', $header); $this->saveReport('example'); } private function setSheetName($sheetName) { $this->sheet->Name = $sheetName; } private function setHeader($title, $header) { $cell = $this->sheet->Range('A1'); $cell->value = $title; foreach($header as $key => $value) { $cell = $this->sheet->Range($key . '2'); $cell->value = $value; } } private function setReport($value, $from, $to, $header) { $report = $this->brdata->get_sectionReport($value, $this->today, $from, $to); for ($i=3;$i<count($report);$i++) { foreach($header as $key => $value) { $cell = $this->sheet->Range($key . $i); $cell->value = $report[$i][$this->columns[$value]]; if($value == "ITEM DESCRIPTION") { $cell->HorizontalAlignment=-4108; } } } } private function styleReport() { } private function SaveReport($documentName) { $this->book->SaveAs('C:\wamp\documents\\' . $documentName . '.xls');//Enregistrement du document $this->sheet = null;//Libération de $sheet $this->book = null;//Libération de $book $this->excel->Workbooks->Close();//Fermeture du classeur $this->excel->Quit();//On quitte Excel $this->excel = null;//Libération de l'objet $excel } 

}

f我理解正确,PHP COM对象使用VBA …是否有类似的function?

谢谢你的帮助 !! 🙂