Welcome to WebmasterWorld Guest from 50.17.16.177

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

MySQL and PHP to Present Excel Spreadsheets

     
9:14 pm on Apr 24, 2006 (gmt 0)

New User

10+ Year Member

joined:Nov 2, 2005
posts:10
votes: 0


Now, for that "Stupid IE Trick"! *drum roll* ....
There is a bug in Internet Explorer that causes the browser to fail on recognition of some HTTP headers,
including Excel. But we are still looking for that "one-click pony", so how do we overcome this problem? Thanks to input from thelist a solution was gained through the use of a phantom link, a link that fools Internet Explorer about the content type of the information. The URL to the spreadsheet needs to be like this;

<a href="http://yourservername/crosstab.php/crosstab.xls">

By linking this way the PHP will get processed properly and the phantom crosstab.xls will say to Internet Explorer that Excel type information is coming. I can recieve the file as a download just fine. but when i try to just view the file in a browser with out the d/l file the total returns as total score sum=1a2b so on.placeing the code above should fix this i think ,How and where does this code go on the page? Thanks in advance!.

10:09 pm on Apr 30, 2006 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12533
votes: 0


IE is indeed a pain. All you can do is send the correct headers and the rest depends on the user's browser setup. Yes, spoofing the url also helps with IE. What headers are you currently firing?
4:08 am on May 1, 2006 (gmt 0)

New User

10+ Year Member

joined:Nov 2, 2005
posts:10
votes: 0


Hi coopster . Here is my header
?>
header("Content-Type: application/vnd.ms-excel");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
<?

Thanks for your time in advance.

10:03 am on May 1, 2006 (gmt 0)

New User

5+ Year Member

joined:May 1, 2006
posts:2
votes: 0


Try this. I have had the same probs.

application/vnd.msexcel

11:16 am on May 1, 2006 (gmt 0)

New User

10+ Year Member

joined:Nov 2, 2005
posts:10
votes: 0


Hi Beno Thanks for your help But the header line that this is in, has to be removed before it will display in my browser, other wise it wants to down load a file . I don't want to down load the file just display as a page. Ruffain
10:34 am on May 2, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Jan 7, 2003
posts:1230
votes: 0


just a silly question, but shouldn't your code


?>
header("Content-Type: application/vnd.ms-excel");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
<?

be that way:


[b]<?[/b]
header("Content-Type: application/vnd.ms-excel");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
[b]?>[/b]

?

--hakre

12:03 pm on May 3, 2006 (gmt 0)

New User

10+ Year Member

joined:Nov 2, 2005
posts:10
votes: 0


Yes you are correct harke good eye. the start and end tag is correct in my code . But i had to look after your post. lol Thanks to all that have looked at my post but i still have the same problem.Please help i'm pulling me hair out... Ruffain
7:18 am on May 4, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Jan 7, 2003
posts:1230
votes: 0


ruffain, do i get you right this way: you want IE to display the excell spreadsheet directly in the browserwindow as a so called "active document" ("office plugin for ie")? and further, the file is displayed within IE but the in the file contained macros are not executing?

what i would do is to place a that kind of spreadsheet file directly on the server and request it without php inbetween, then analyzing that request incl. the headers. use php later on to simulate the complete same behavior, maybe ajoute mod_rewrite to completely fake the request (which should not be necessary with your example URL).

--hakre

7:59 am on May 4, 2006 (gmt 0)

New User

10+ Year Member

joined:Nov 2, 2005
posts:10
votes: 0


Hi harke at this point i'm will to try any thing . could i send you my code some how and you show me what you mean? thanks Ruffain
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members