PHPReport
PHPReport copied to clipboard
how to make multisheet?
i have try https://github.com/vernes/PHPReport/wiki/Examples-with-templates this ok, but how i can make multisheet in excel template?
how i can manage array with one in multisheet...
Currently you can't create multisheet documents. But that option is on todo list.
Thanks for your excellent job, vernes! As my expediency, simply make little change in "render" method as following. Please pay attention, this is only for "_usingTemplate" situation.
//create or generate report if ($this->_usingTemplate) { $sheets = $this->objPHPExcel->getAllSheets(); if(count($sheets) > 1){ foreach ($sheets as $sheet){ $this->objWorksheet = $sheet; $this->generateReport(); } } else{ $this->generateReport(); } } else { $this->createReport(); }
To reducing the unnecessary loops, I also add a parameter named "forSheet" to determine the current sheet. public function generateReport() { $this->_lastColumn=$this->objWorksheet->getHighestColumn();//TODO: better detection $this->_lastRow=$this->objWorksheet->getHighestRow(); foreach($this->_data as $data) { $forSheet = isset($data['forSheet']) ? $data['forSheet'] : null; $title = $this->objWorksheet->getTitle(); if(!empty($forSheet) && $forSheet != $title){ continue; } ... } ... }