0
$filename ="cs_orderfrequency.xls";
$contents = $this->load->view('reports/order_frequency_excel',$data);
header('Content-type: application/ms-excel');
header('Content-Disposition: attachment; filename='.$filename);

This code enables me to export directly a view to excel file without having to use PHPExcel as thirdparty. Although it gives me an error of
"The file your trying to open is in a different format than specified by the file extension " , data can still be viewed once button "OK" is clicked..This works in Excel 2007 to 2016..

Over a month ago upon windows update that may have affected Excel, in Excel 2013 to Excel 2016, the file can be open but no data is shown, it just go back to the home screen of selection of excel template. I tried opening the file in Excel 2010 , the file behaves just as mentioned above. There is a prompt but data is still viewable.

Do you have any idea guys about MS Excel 2016 ? I have browsed through Excel -> File ->Options trying to reconfigure excel 2016 but to no luck , still blank ..

===========
on the other note, the reason I've tried the code above is because PHPExcel does not support multiple rows. I have rows up to 10000+ and it return memory limit exhausted although I have increased memory limit of my php.ini up to 2GB

thanks :)

2
Contributors
1
Reply
8
Views
1 Year
Discussion Span
Last Post by cereal
0

Not tested, could be the encoding? Try, for example, to add ;charset=utf-8 to the content type header.

Edited by cereal

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.