Color of a cell

Topics: Developer Forum, User Forum
Jul 19, 2008 at 7:21 PM
Edited Jul 20, 2008 at 6:34 PM
Hello,
    
    I simply want to read the inner color of a cell in an Excel 2000 document, I can read the content of each record in my document, but cannot read the background color of the cells.  I post my message here after searching a while, because several searches over the Internet guided me to this discussion group. Sorry if an answer to a similar question is to be found here. I have this code:

        $objReader = new PHPExcel_Reader_Excel5();
        $objPHPExcel = $objReader->load($_SERVER["DOCUMENT_ROOT"].$monstring);
        $cell = "A10";
        $cellColor = $objPHPExcel->getSheet(0)->getStyle("$cell")->getFill()->getStartColor()->getRGB();
        echo $cellColor;

    It prints "FFFFFF" although the background color of cell "A10" of my document is "Light Turquoise".


I also can read another color: it's
    
    $cellColor = $objPHPExcel->getSheet(0)->getStyle("$cell")->getFill()->getEndColor()->getRGB();

It gives me "FF0000"


Note: when I try

   $cell ="A10";
   $cellFillType = $objPHPExcel->getSheet(0)->getStyle("$cell")->getFill()->getFillType();

$cellFillType contains "none", wich indicates me than I'm perhaps not reading the right property.




Can you please indicate me if this fonction of getting the color of a cell does exist. This will be used in an end year school work.


Thanks in advance
Jul 20, 2008 at 11:20 AM
Edited Jul 20, 2008 at 6:31 PM
Regards
Developer
Jul 21, 2008 at 3:28 PM
I made some tests, and it does seem to be the case that Excel 5 reader is not reading the background color for cells. But you may need some developer to confirm this.

Excel 2007 reader is able to read background colors, at least when it is not set as a theme color.
http://www.codeplex.com/PHPExcel/WorkItem/View.aspx?WorkItemId=7033

Would it be possible to finish your project using the Excel 2007 format?
Jul 21, 2008 at 6:44 PM
Edited Jul 21, 2008 at 7:06 PM
Thank you for the information, unfortunately the file is not mine and I must ask to save it in Excel 2007 format