To generate XLSX use
Define in $xlsName the name of the XLSX with the extension. Example: $xlsName = 'test.xlsx';
$objPHPExcel = new PHPExcel();
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="'.$xlsName.'"');
header('Cache-Control: max-age=0');
$objWriter->save('php://output');
For XLS use
Define in $xlsName the name of the XLS with the extension. Example: $xlsName = 'test.xls';
$objPHPExcel = new PHPExcel();
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="'.$xlsName.'"');
header('Cache-Control: max-age=0');
$objWriter->save('php://output');
Is there a code? Something’s wrong?
– rray
I was starting from scratch, but I was able to walk around a little bit taking out some macros that existed in the spreadsheet. 
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($inputFileName);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(15);

$objPHPExcel->setActiveSheetIndex(0) ->setCellValue('C3', $numRegister);
– Rodrigo Mota Sousa
To download you can use this code
header('Content-Type: application/vnd.ms-excel;');
header('Content-Disposition: attachment;filename=plan.xls');
header('Content-Transfer-Encoding: binary');
header('Cache-Control: max-age=0');
 
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
– rray
Thank you! I’ll test it here.
– Rodrigo Mota Sousa
Taking advantage of space, it worked perfectly. Now I wanted to get a file in stored in a blob field in mysql, I would like to grab it, temporarily store, edit and download it on the machine, has how to do?
– Rodrigo Mota Sousa
I believe that reply can help.
– rray
Thanks, I’ll take a look at the documentation of this class here.
– Rodrigo Mota Sousa