I want to create an xlsx file and I'm using PHPExcel. For now I just added a line and I'm trying to create and save the file but it doesn't work.
My code is :
$objPHPExcel = new PHPExcel();
$chemin = "./././files/resultats/simulation".$singleton->getNom()."_".date("d").".".date("m").".".date("y").".xml";
$xmlFile = simplexml_load_file($chemin);
$ligne = "3";
$colonne = "B";
foreach ($xmlFile as $xml) //on aprcours les attributs <Simulation>
{
$objPHPExcel->getActiveSheet()->setTitle('Synthèse système culture');
$objPHPExcel->getActiveSheet()->setCellValue("B".$ligne,"Nom du système de culture");
$objPHPExcel->getActiveSheet()->mergeCells("B3:B4");
$ligne++; //Quand on termine une simulation, on ajoute une ligne pour afficher la simulation suivante sur la ligne du dessous
}
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="test.xlsx"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('test.xlsx');
What is wrong with that ? I'm trying to save "test.xlsx" and it doesn't work.