I am using Cakephp 2.0. I need to generate a Report on daily basics in an excel format.
So i written a function to generate a CSV File. Its working fine in Linux machine when i downloads the file in OpenOffice but if I try to open the same file in windows Microsoft then there is no cells, but the data is displaying properly. With this I listed my coding
$model.= "-".date('d M,Y');
header ("Expires: Mon, ".date('d M,Y')." GMT");
header ("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
header ("Content-type: application/vnd.ms-excel");
header ("Content-Disposition: attachment; filename=\"$model.xls" );
header ("Content-Description: Generated Report" );
Any one helps thanx
I think you might doing something wrong here Please check your header. You have mentioned csv in the question and you’re writing excel header. That is might be confusing
MS ExcelI’m using this kind of header format which is perfectly working for me in windows and as well as in Open office. Please give a try with this.