Jul 3, 2014 at 11:32 AM
Edited Jul 3, 2014 at 11:33 AM
I'm new to PHPExcel.
I have a script that loops through a dataset and clones a template worksheet for each location I wish to report on.
The script includes and makes several calculations and includes any uploaded images from the user. This is all fine and works very well.
My problem comes when I try to change the background colour of a cell in the current worksheet in the loop.
I use this code:
$objWorkSheet->getStyle('E10')->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,'color' => array('rgb' => 'FFCC00'))));
The result is confusing.
The cell that gets coloured is not in the correct worksheet, but either the one before or one after the desired tab.
I have tried using a slightly different syntax:
$objPHPExcel->getActiveSheet()->getStyle('E10')->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,'color' => array('rgb' => 'FFCC00'))));
But with the same results.
At the end of the loop, I remove the template worksheet, like this:
Does this make sense?
I can add more code or a sample XL if needed.
Any help would be greatly appreciated