03 Jan, 2006
Bug in php_writeexcel and how to generate real Excel file with PHP
Posted by: Loopion In: Web development
While I was working on Baron Cocoa website (http://www.fontaine-chocolat.com/ my LFD Project indirectly), I found how to fix a bug on “php_writeexcel” library.
Firstable, i will explain what does php_writeexcel is useful for and why use it, then I’ll explain how it began to bug…and of course how to resolve this bug (Thx to Guillaume Maes from Celeonet who help me to resolve this bug).
All my customers need Excel file to manipulate their data in a more simple space and a more sharable format because they practice Microsoft Office documents in every company (almost) maybe one day i will implement an OpenDocument exporter (.ods) but these days all my customers wants .xls, NOT CSV !!!
I found php_writeexcel for PHP and it’s really userfriendly and simple to use. Please see how to use the class with the example or with the documentation. The actual version is 0.3.0 but in this version you have a bug when the temporary directory isn’t set by default to
$this->_tempdir = "tmp/";
.
Now if you have a open_basedir restriction in effect it means that you have a different directory for the generated Excel document.
How to resolve this bug :
- Open the
class.writeexcel_workbook.inc.php
- Go at line : 70 where
-
//? $this->_tempdir = undef;
-
- Remove the
-
//?
and replace
-
undef
by
-
"youpath"
-
Now, you’ll be able to generate your REAL Excel file.





Add New Comment
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks