homepage Welcome to WebmasterWorld Guest from 54.167.174.90
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
MySQL and PHP to Present Excel Spreadsheets
ruffain

5+ Year Member



 
Msg#: 12629 posted 9:14 pm on Apr 24, 2006 (gmt 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!.

 

coopster

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



 
Msg#: 12629 posted 10:09 pm on Apr 30, 2006 (gmt 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?

ruffain

5+ Year Member



 
Msg#: 12629 posted 4:08 am on May 1, 2006 (gmt 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.

beno9487

5+ Year Member



 
Msg#: 12629 posted 10:03 am on May 1, 2006 (gmt 0)

Try this. I have had the same probs.

application/vnd.msexcel

ruffain

5+ Year Member



 
Msg#: 12629 posted 11:16 am on May 1, 2006 (gmt 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

hakre

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 12629 posted 10:34 am on May 2, 2006 (gmt 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

ruffain

5+ Year Member



 
Msg#: 12629 posted 12:03 pm on May 3, 2006 (gmt 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

hakre

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 12629 posted 7:18 am on May 4, 2006 (gmt 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

ruffain

5+ Year Member



 
Msg#: 12629 posted 7:59 am on May 4, 2006 (gmt 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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved