Home » Php » php – PHPExcel: How to get a CELL COLOR

php – PHPExcel: How to get a CELL COLOR

Posted by: admin July 12, 2020 Leave a comment

Questions:

I am using PHPExcel project, but I am having a question in mind, and without solution on the earth.

I had googled for this question for a while, but I CAN NOT find a way to get a CELL BACKGROUND COLOR!

I tried to use the method ‘getColor()’ or what … it doesn’t work or just shows the warning message…

Can somebody please tell me how to get a CELL COLOR using PHPExcel? THANKS

How to&Answers:
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFill()->getStartColor()->getARGB();

or

$objPHPExcel->getActiveSheet()->getStyle('A1')->getFill()->getStartColor()->getRGB();

Answer:

examples<
http://bayu.freelancer.web.id/2010/07/16/phpexcel-advanced-read-write-excel-made-simple/

Answer:

to set background for specific cells.it’s works for me

$objPHPExcel->getActiveSheet()->getStyle('A1')->getFill()->applyFromArray(array('type' => PHPExcel_Style_Fill::FILL_SOLID,'startcolor' => array('rgb' =>'FF1E1E')