title: PHPExcel generated excel file not working. (File format or extension is invalid )
body: <p>PHPExcel generated excel file not working. (File format or extension is invalid)</p>
  
  <p>The example code of PHPExcel exceutes successfully on my local PC, the file gets downloaded to local and is opened in Excel 2007 successfully.
  But using the same code on my server gives an Invalid file to excel, which when I OPEN AND REPAIR, then it opens successfully.</p>
  
  <p>I don't want to use the Open and Repair option, but only the Open option.</p>
  
  <p>Couldn't find out the problem? Please help.</p>
  
  <pre><code>$objPHPExcel-&gt;setActiveSheetIndex(0);
  
  //for XLSX
  header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
  header('Content-Disposition: attachment;filename="item_list.xlsx"');
  header('Cache-Control: max-age=0');
  
  $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
  $objWriter-&gt;save('php://output');
  
  exit;
  </code></pre>