title: How to export PHP to stylized CSV or XLS without using PEAR and Spreadsheet_Excel_Writer?
body: <p>I need to export the output of php script to xls or csv file. Output file must be formatted (font size, font weight, borders etc).</p>
  
  <p>I have two options:</p>
  
  <ol>
  <li>content variable as string with html tags (formatted text)</li>
  <li>an array with data ready to be formatted</li>
  </ol>
  
  <p>The easiest way I think is to export variable containing html code strict to xls file which I just did. The only problem is when I download xls file and open it, Excel alerts me that opened file format is different that file extension.</p>
  
  <p>Headers in my php script:</p>
  
  <pre><code>header("Content-Type: application/xmls.ms-excel");
  header("Content-Disposition: attachment;filename=test.xls");
  header("Content-Transfer-Encoding: binary");
  </code></pre>
  
  <p>Charset is set to UTF-8.</p>
  
  <p>Also I'm able to use array variable with data that I need to put in cells, but:</p>
  
  <ol>
  <li>I don't know how to format cells (fonts, borders etc)</li>
  <li>I don't know how to put data in exact cell</li>
  <li>I'm not able to use PEAR and Spreadsheet_Excel_Writer</li>
  </ol>
  
  <p>Any further help will be appreciated.</p>