I am using PHPExcel in a project and you need to style excel sheet cells.
What I did was create a PHPExcel style object, for example:
$style['red_text'] = new PHPExcel_Style();
Then I use the set functions in this style to populate the object as follows:
$style['red_text']->getFont()
->applyFromArray(
array('name'=>'Arial')
)
Now I am trying to use this style object in a cell. I tried to use the applyFromArray function as follows:
$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow($x, $y)->applyFromArray( $style['red_text'] );
This is not a way to do this, I don’t think. For me, this is the most readable and consistent way of assigning styles, but if someone who is more fluent in PHPExcel can direct me to the right method, I would be very obliged!
PS Sorry for the formatting; this is my first post :)
EDIT: just found an error in this: "Invalid style array passed"
Does this mean that I am not creating the style object correctly?