Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I select multiple cells or a set of ranges in order to style them?

Tags:

php

phpexcel

I know I can access a range of cells in order to format them:

$objPHPExcel->getActiveSheet()->getStyle('B3:B7')->getFill()
    ->setFillType(PHPExcel_Style_Fill::FILL_SOLID)
    ->getStartColor()->setARGB('FFFF0000');

Now is there a way, and if yes, how can I define multiple cells or a set of ranges within the getStyle() call? I tried

$objPHPExcel->getActiveSheet()->getStyle('B3:B7;C6:C12')->getFill()->...

and

$objPHPExcel->getActiveSheet()->getStyle('B3;C9;D2;E6')->getFill()->...

but both didn't work and threw an error.

like image 668
Gottlieb Notschnabel Avatar asked Sep 14 '25 16:09

Gottlieb Notschnabel


1 Answers

According to Mark Baker (Coordinator of the PHPOffice suite of Open Source libraries),

that doesn't work, [you can] only [define] one range at a time.

Source: Comments above.

like image 142
Gottlieb Notschnabel Avatar answered Sep 17 '25 05:09

Gottlieb Notschnabel