I using exporting data to excel 2007 using PhpExcel 1.8.0. Its working but Excel File is saved in Client side but when I open the downloaded Excel file, I get the warning message
We found a problem with some content in 'filename.xlsx'. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes.
I am using PhpExcel library in Magento.
Could anyone help me to solve this problem?
Code is below:
$objPHPExcel->getActiveSheet()->setTitle($store_name." Product List");
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
header("Content-Disposition: attachment; filename=".Mage::getBaseDir().'/media/productpricinglist/'.$store_name.'product_list.xlsx');
header("Cache-Control: max-age=2");
ob_clean();
$objWriter->save("php://output");