php - How to apply styles in PHPExcel -
i working phpexcel & want give same style cells. have tried below code, applies style a1.
$objphpexcel->getactivesheet()->getstyle('a1','b2','b3','c4')->getalignment()->setindent(1);
you can't provide list of cells 'a1','b2','b3','c4'
because getstyle()
accepts single argument; argument can either single cell (e.g. 'a1'
) or range of cells 'a1:c4'
so
$objphpexcel->getactivesheet() ->getstyle('a1:c4') ->getalignment()->setindent(1);
is acceptable, , recommended because it's lot more efficient setting styles range individual cells