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.
$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->save('php://output');
exit;
this is same to Displaying excel file in a browser. PHPExcel
@helicera: You will need to give the filename the xlsx extension. – alex Jan 18 '12 at 7:05
But where can I give xlsx extention after removing header('Content-Disposition: attachment;filename="report.xlsx"'); line ?
======================== from loading excel ==================
<?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->save('example.html');
?>