I am printing excel like this:
header("Content-Type: application/vnd.ms-excel; charset=utf-8");
header("Content-type: application/x-msexcel; charset=utf-8");
header("Content-Disposition: attachment; filename=".str_replace(' ', '_', $title).".xls");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
The content is plain html. The problem, when I download this, I get an initial confirmation box written
The file you are trying to open 'File_name.xls', is in a different format than specified by the file extension. Verified that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?
When I do ‘yes’, I get this. Bit strange, any input here friends please ?

Well, this one suddenly got solved, I don’t know how.
This is what I did. I copied and pasted codes of a different page where the excel thing was working. Then, I changed the variables manually to adapt this with the 2nd page.
After some hit and try, it suddenly worked.
Thanks for all the answers anyway.
PS. By solved, I mean that excel is not crushing anymore, though I am still getting the confirm box about incorrect format.