Results 1 to 2 of 2
Hi all,
I'm exporting data to excel file in php,but the data starts at middle of excel sheet.
How to correct this?
Here is sample code with i used,
Code:
...
- 08-13-2007 #1
php + download excel
Hi all,
I'm exporting data to excel file in php,but the data starts at middle of excel sheet.
How to correct this?
Here is sample code with i used,
ThanksCode:$header = "Number \t Color \tSize "; $filename="product"; //Fetch data and assign to $data $data = "a"; $data .= "b"; //sent the data to browser header("Content-type: application/x-msdownload"); header("Content-Disposition: attachment; filename=" . $filename . ".xls"); header("Pragma: no-cache"); header("Expires: 0"); print "\n$header"; print "\n$data";- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 08-13-2007 #2
i found this at google.....now excel files contents comes at second line ...(that's huge improvement
.....
Code: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- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------


Reply With Quote