J'utilise la bibliothèque phpexcel pour exporter mon rapport vers un fichier Excel. mais je veux avoir mon propre fichier Excel et l'utiliser avec phpexcel. est ici le code i utilisé:en utilisant phpexcel dans codeigniter
public function event_reportexcel($id)
{
$this->load->library('excel');
$this->excel->setActiveSheetIndex(0);
$this->excel->getActiveSheet()->setTitle('test worksheet');
$this->excel->getActiveSheet()->setCellValue('A1', 'This is just some text value');
$this->excel->getActiveSheet()->getStyle('A1')->getFont()->setSize(20);
$this->excel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
$this->excel->getActiveSheet()->mergeCells('A1:D1');
$this->excel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$filename='just_some_random_name.xls'; //save our workbook as this file name
header('Content-Type: application/vnd.ms-excel'); //mime type
header('Content-Disposition: attachment;filename="'.$filename.'"'); //tell browser what's the file name
header('Cache-Control: max-age=0'); //no cache
$objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5');
//force user to download the Excel file without writing it to server's HD
$objWriter->save('php://output');
}
il va mettre mes données dans un nouveau fichier Excel, mais j'ai besoin de cette fonction pour utiliser un fichier Excel en tant que modèle.
duplication possible de [Comment ouvrir un fichier Excel avec PHPExcel pour lire et écrire?] (Http://stackoverflow.com/questions/8797103/how-to-open-an-excel-file-with-phpexcel -pour la fois lecture et écriture) –