Okay, I think I solved my problem. This appears to be a buffering
problem. It's probably something specific to PHP 5.3.3 on my copy of
Squeeze. I did turn output_buffering=off in the php.ini file, but it
had no effect. In the end I stumbled on this rather simple solution.
Before I invoke $objWriter->save('php://output'), I put in a
ob_end_clean(). Something like:
$objPHPExcel = new PHPExcel();
$objPHPExcel->getActiveSheet()->setTitle('Simple');
ob_end_clean();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");;
header("Content-disposition: attachment; filename=test.xlsx");
header("Content-Transfer-Encoding: binary ");
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');
When I do that, an uncorrupted xls file is downloaded that I can open in Excel.
Thanks everyone for your help! Another mystery solved...
Aaron Clausen