Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Expert Help needed! .Display spreadsheet in a browser

Status
Not open for further replies.

sharugan

Programmer
Jul 23, 2007
14
US
I have a spredsheet that contains the data.I need to display the spreadsheet in a browser when the user types the url of the website.It should n't pop up "save as" dialog box to open / save the spreadsheet.
I am using the following code , but it opens the pop up window.How do i avoid the pop up window.
I also tried <a herf="one.xls"> in html . that also opens the pop up windows.
<?php

$export_file = "worldmap.xls";
ob_end_clean();
ini_set('zlib.output_compression','Off');

header('Pragma: public');
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
header ("Pragma: no-cache");
header("Expires: 0");
header('Content-Transfer-Encoding: none');
header('Content-Type: application/vnd.ms-excel;'); // This should work for IE & Opera
header("Content-type: application/x-msexcel"); // This should work for the rest
header('Content-Disposition: attachment; filename="'.basename($export_file).'"');


?>
 
unless you render the content of the spreadsheet as html, you cannot control the behaviour of the browser (i.e. to dire up an excel reader plugin) from php.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top