Background color is not correct in excel5 file

Dec 1, 2008 at 1:38 AM

I'm using phpexel 1.6.4. I have a spreadsheet (xls) that have difrerent background color for each row. I load the spreadsheet with the reader class, edit the content, and  then save it. But after it is saved, the colors doesnt match with the original one i created..No error is reported.. I think this is just a bug of phpexcel..

Note : i'm using ms excel 2007 to save the spreadsheet (save to excel5/ *.xls) , but dont know whether it is compatible or not.

Thx so much..
Dec 1, 2008 at 1:51 AM
There were some issues with the Excel5 reader not reading user-defined colors. This was only fixed recently which could explain why PHPExcel 1.6.4 is not working.

Can you please try with latest source? Pick latest source from here:

Feb 14, 2009 at 8:11 PM
I've tried several colors that I know are supported in the Excel BIFF default palette and still no joy.
The colors are not the same in the Excel5 and Excel2007 files.
Try the following setting to see that they are not producing the same background color.

I understand that BIFF only has a 56 color palette -- which is fine, if I could just figure out how to assign a color setting to use the intended color.
Help is appreciated.

Feb 14, 2009 at 8:21 PM
Will check up on this! It looks like I misread the post by feiferry.
Feb 15, 2009 at 1:17 AM
It looks like the problem is with your code.

You have this:


Try instead like this:


Sep 21, 2010 at 9:56 AM

Hello guys,

replacing setARGB() with setRGB() is correct.
A college of mine noticed that the only difference between RGB and ARGB color defintions could be the presence of a alpha channel.
Since Excel2000 -and up- are not supporting this, it would be usefull to use HEX colors with a "default" alpha value of FF.
This would result in black being: FF000000 and orange FFFF6600.

I noticed that the difference between the function setARGB and setRGB is only the prependation of FF.

I hope this makes the usage a bit more clear.


Twan van der Poel