title: PHP Excel Blank Rows and Headers
body: <p>In using PHP to output an Excel file, it is working fine, however, each Excel file has 3 blank rows at the top. The headers are such:</p>
  
  <pre><code>&lt;?php
  header ("Expires: Mon, 28 Oct 2008 05:00:00 GMT");
  header ("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT");
  header ("Cache-Control: no-cache, must-revalidate");
  header ("Pragma: no-cache");
  header ("Content-type: application/vnd.ms-excel");
  header ("Content-Disposition: attachment; filename=\"GridExport.xls" );
  header ("Content-Description: Generated Report" );
  echo $content_for_layout;
  ?&gt;
  </code></pre>
  
  <p>In looking at the 3 blank rows in a text editor such as notepad, I actually see one blank row, following by a row with a single space, following by another blank row, so that is basically equivalent to:</p>
  
  <pre><code>\n.\n\n
  </code></pre>
  
  <p>where the period = single space. </p>
  
  <p>Finally, when I do open the file in Excel > 2003, I get this error message about the file not being in the right format, yet clicking yes opens it fine (minus the 3 blank row problem). <strong>Is it possible to send the right headers to not get this message?</strong> See a screenshot at:</p>
  
  <p><a href="https://twiki.auscope.org/wiki/pub/Grid/WfsReaderWs/OpenFileWarning.png" rel="nofollow">https://twiki.auscope.org/wiki/pub/Grid/WfsReaderWs/OpenFileWarning.png</a></p>