title: PHPExcel and Php MVC Framework
body: <p>I'm developing a basic php framework and y have a problem. I want to use PHPExcel for  download reports in excel. </p>
  
  <p>This is my Controller:</p>
  
  <pre><code>public function export(){
  
          require_once ROOT."libs".DS."PHPExcel/PHPExcel.php";        
  
  
          header('Content-Type: application/vnd.ms-excel');
          header('Content-Disposition: attachment;filename="sites.xls"');
          header('Cache-Control: max-age=0');
  
          $objPHPExcel = new PHPExcel();  
  
  
          $writer = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
          $writer-&gt;save('php://output');
  
      }
  </code></pre>
  
  <p>The PHP library is here:</p>
  
  <p><img src="https://i.stack.imgur.com/1dkha.png" alt="enter image description here"></p>
  
  <p>When I open the excel file get the following:</p>
  
  <pre><code>ÐÏà¡±á;þÿ
  
  þÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿà…ŸòùOh«‘+'³Ù0¸@Hh€˜
  ¤°äUntitled SpreadsheetUnknown CreatorUnknown Creator@`Do›ßÎ@`Do›ßÎ
  ÌÑB°=¼%r8X"1ÜCalibriàõÿ À
  
  ÌÑ*+‚€Áƒ„&amp;ffffffæ?'ffffffæ?(è?)è?¡"dXX333333Ó?333333Ó?U}$
  þÿÕÍÕœ.“—+,ù®0¼HPX`hp
  xŽä
  WorksheetFeuilles de calculRoot Entryÿÿÿÿÿÿÿÿ
  </code></pre>
  
  <p>I hope you can help. Thanks</p>