user1372212
user1372212

Reputation: 393

Color issues using PHPExcel

I'm experiencing issues setting a background color in PHPExcel.

I have done this many many times and am wondering if this is a bug in PHPExcel itself.

The code I use is

$objPHPExcel->getActiveSheet()->getStyle('D17')->getFill()
->setFillType(PHPExcel_Style_Fill::FILL_SOLID) ->getStartColor()->setRGB('ff0000');

I am trying to set the following hex colour a87ac6 this is a shade of purple, when i put this code in

$objPHPExcel->getActiveSheet()->getStyle('D17')
->getFill() ->setFillType(PHPExcel_Style_Fill::FILL_SOLID)
->getStartColor()->setRGB('A87ac6');

The cell is actually showing up grey rather than purple.

Could someone advise?

Upvotes: 0

Views: 760

Answers (1)

Grzegorz Pawlik
Grzegorz Pawlik

Reputation: 2236

Ok, apparently it is not related with PHPExcel but with this specific version of Excel (2008) on Mac. It recognizes just the colors from its palette which by default is limiting them to about 50-60 colors. Updating Excel version will fix the issue.

Upvotes: 2

Related Questions