Weird Fill Color Issue

Topics: User Forum
Nov 8, 2007 at 10:18 AM
I'm having a strange issue when trying to fill certain cells with a color.

I'm using * @version 1.5.0, 2007-10-23
And using Excel5 output.

Here is the code that i am trying to get working -
$r =6
$objPHPExcel->getActiveSheet()->getStyle("A$r")->getFill()->setFillType(PHPExcelStyleFill::FILL_SOLID);
$objPHPExcel->getActiveSheet()->getStyle("A$r")->getFill()->getStartColor()->setARGB('FF808080');

For some reason this is coloring the whole row 6. When it should only be doing cell A6.

If i use the code below then i get the desired results but i need to use variables as my colouring is part of a loop.

$objPHPExcel->getActiveSheet()->getStyle("A6")->getFill()->setFillType(PHPExcelStyleFill::FILL_SOLID);
$objPHPExcel->getActiveSheet()->getStyle("A6")->getFill()->getStartColor()->setARGB('FF808080');

Any ideas?

Thanks

Chris

Coordinator
Nov 9, 2007 at 9:36 AM
Can you try this:
$objPHPExcel->getActiveSheet()->getStyle("A" . $r)->getFill()->setFillType(PHPExcelStyleFill::FILL_SOLID);