NYCPHP Meetup

NYPHP.org

[nycphp-talk] Excel library

bpang at bpang.com bpang at bpang.com
Wed Apr 28 22:46:41 EDT 2004


As long as you set the headers properly, you can just use an html table as
an excel file.
I've had good success with this and have so far produced up to a 3mb file.
The only problem I've encountered is that I've only been able to Excel to
open the spreadsheet when it's that large. OpenOffice.Org essentially
hangs on it, as does Gnumeric. Too much parsing, I guess.

oh, when I say "set the headers" I mean if you're having php stream the
file out, else you can write it to a location and then the browser should
handle it right with the .xls extension.

when routing an existing/created file through php using fpassthru():
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=\"$filename\"");


when streaming php output:
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=$xlsFilename");
header("Pragma: no-cache");
header("Expires: 0");


I know you're asking for an Excel library, but this does work. Heck, I'd
even call it v1.0 :)


> Anyone can recommend a Excel library?
>
> Someone mentioned
> http://pear.php.net/package/Spreadsheet_Excel_Writer
> but I wonder if it is reliable enough for production. I get nervous around
> software still marked "beta 0.7"
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>




More information about the talk mailing list