/** * Retourne le tableau au format excel * */ public function getExcel() { //Inclusion de la classe pour gnération des fichiers excel require_once COPIX_PATH . '../excelwriter/excelwriter.inc.php'; $excel = new ExcelWriter("temp.xls", "", ""); if ($excel == false) { throw new Exception($excel->error); } //Création de la ligne de titre if (count($this->_title) > 0) { $tabTitle = array(); foreach ($this->_title as $key => $titre) { $tabTitle[utf8_decode($titre)] = isset($this->_size[$key]) ? $this->_size[$key] : $this->_defaultSize; } $excel->writeLine($tabTitle, "gras"); } //Création des lignes de données foreach ($this->_array as $line) { $excel->writeRow(); if (count($this->_mapObject) > 0) { foreach ($this->_mapObject as $key => $map) { $size = isset($this->_size[$key]) ? $this->_size[$key] : $this->_defaultSize; $excel->writeCol(utf8_decode($line->{$map}), $size); } } else { foreach ($line as $key => $cell) { $size = isset($this->_size[$key]) ? $this->_size[$key] : $this->_defaultSize; $excel->writeCol(utf8_decode($cell), $size); } } } //Fin du document $excel->close(); return $excel->getData(); }