Reputation: 35567
I have an iframe that contains a report, which also allows a user to click on a link to open the report within MS Excel.
My problem here is that when the user clicks on the link to export and open up within MS Excel, it actually opens within the broswer window - MS IE6 instead of MS Excel, which I don't want.
Any ideas how to get around this?
Upvotes: 1
Views: 1026
Reputation: 40685
Are you sending the correct headers to the client?
For Excel, these headers could look lik that:
header('Content-type: application/vnd.ms-excel; charset=yourcharset');
header('Content-Disposition: attachment; filename=yourfilename.xls");
And if you get your Excel sheet opened correctly but still in the browser window, you can do two things. 1) Change that setting on your local machine OR 2) Use application/octet-stream as Content-type. Then the browser won't try to open the file.
Upvotes: 1