tags:

views:

66

answers:

1

Hi, I hope someone can assist me.

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?

Thanks. Tony.

+1  A: 

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.

tharkun
sorry tharkun - what do you mean? Are you able to provide me an example of what you are referring to - thanks.
tonsils
@Andrew: how can you know that the proper headers are bing sent? :)
tharkun
@Andrew: I've made the experience that Excel isn't able to display utf-8 encoded content correctly.
tharkun
please elaborate!
tharkun
well, I've got 2007 and if I export csv/xls from utf-8 I always get the chars messed up.
tharkun
if I would add charset: utf-8 in Content-type, would I get it right?
tharkun
@andrew: it MUST not have the BOM in PHP!
tharkun
end of discussion because you don't manage to explain what you mean? or?
tharkun
oh, nice. not talking to ppl who know less than yourself and deleting all your comments... what does that make me :) a lunatic who talks with an imaginary friend :D
tharkun