title: Displaying excel file in a browser using PHPExcel and PHPExcel_Writer_Excel2007
body: <p>Issue regarding displaying excel content in browser without asking to save the attachment.
  I can open excel file download via attachment. But can't get show it in browser.</p>
  
  <pre><code>$writer = new PHPExcel_Writer_Excel2007($spreadsheet);
  //$writer =  PHPExcel_IOFactory::createWriter();
  ob_end_clean();
  header('Content-Type: application/vnd.openxmlformats-  officedocument.spreadsheetml.sheet');
  ob_end_clean();
  $writer-&gt;save('php://output');
  exit;   
  </code></pre>
  
  <p>this is same to
  <a href="https://stackoverflow.com/questions/8906202/displaying-excel-file-in-a-browser-phpexcel">Displaying excel file in a browser. PHPExcel</a></p>
  
  <p>@helicera: You will need to give the filename the xlsx extension. –  alex Jan 18 '12 at 7:05 </p>
  
  <p>But where can I give xlsx extention after removing 
  header('Content-Disposition: attachment;filename="report.xlsx"');
  line ? </p>
  
  <p>========================  from loading excel ==================</p>
  
  <pre><code>&lt;?php
  error_reporting(E_STRICT);
  require_once 'PHPExcel.php';
  require_once 'PHPExcel/Writer/Excel2007.php';
  require_once 'PHPExcel/IOFactory.php';
  $inputFileName = 'example.xls';
  $objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
  $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');
  $objWriter-&gt;save('example.html');
  ?&gt;
  </code></pre>