title: PHP Excel file format doesn't match extension
body: <p>I'm getting the above error (Windows only) on XLS files I'm exporting with my PHPExcel Script. Most of the reference I've seen to this error involves trailing/leading spaces/newlines when outputting to <code>php://output</code> (<a href="https://stackoverflow.com/questions/16805851/phpexcel-generated-excel-file-not-working-file-format-or-extension-is-invalid">PHPExcel generated excel file not working. (File format or extension is invalid )</a>. I'm not outputting in that fashion however. Instead I'm outputting the XLS file to a file path on my server and then passing a URL back to the browser to download. I've checked my PHP script and the file that it created for spaces and newlines at the beginning or end and there are none. Here's the section of my code that generates the PHP code.</p>
  
  <pre><code>$xls = new PHPExcel();
  $xls-&gt;getActiveSheet()-&gt;setTitle(substr($reportName, 0, 31));
  $xls-&gt;setActiveSheetIndex(0);
  //iterate over the headers
  foreach($headers as $i =&gt; $header){
      $xls-&gt;getActiveSheet()-&gt;SetCellValue(getExcelColumn($i+1) . '1', $header);
  }
  //iterate over the table contents
  foreach($tableContents as $rowNum =&gt; $row) {
      foreach($row as $col =&gt; $cell) {
          if(strpos($cell, "none specified") &gt; -1)
              $cell = "N/A";
          $cell = explode("&lt;br /&gt;", $cell);
          $cell = implode(", ", $cell);
          $xls-&gt;getActiveSheet()-&gt;SetCellValue(getExcelColumn($col+1) . ($rowNum+2), $cell);
      }
  }
  $fileName = createRandomKey(20) . '-' . $reportName . '.xls';
  $w = new PHPExcel_Writer_Excel2007($xls);
  $w-&gt;save("savedExports/$fileName");
  </code></pre>
  
  <p><code>$headers</code> and <code>$tableContents</code> are taken from <code>$_POST</code> data and there's a few helper functions called in this code.</p>