Issue
I am a bit new on PHPExcel and I'm triying to apply only top and left border in a cells range, each border with different colors. This is what I'm triying to achieve:
I tried with:
$style = array(
'borders' => array(
'top' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
'left' => array('style' => PHPExcel_Style_Border::BORDER_THIN)
),
);
$xls->getActiveSheet()->getStyle($range)->applyFromArray($style);
...
But it didn't work.
Thanks in advance!
Solution
you want de first column #red and the rest #purple..
$objPHPExcel->getActiveSheet()->getStyle($range)->getBorders()->getTop()->applyFromArray(
array(
'style' => PHPExcel_Style_Border::BORDER_DASHDOT,
'color' => array(
'rgb' => #Purple
)
)
);
for the left:
$objPHPExcel->getActiveSheet()->getStyle($range)->getBorders()->getLeft()->applyFromArray(
array(
'style' => PHPExcel_Style_Border::BORDER_DASHDOT,
'color' => array(
'rgb' => #Red
)
)
);
Or you can see the documentation... http://www.cmsws.com/examples/applications/phpexcel/Documentation/API/PHPExcel_Style/PHPExcel_Style_Borders.html#methodapplyFromArray
Cheers,
Answered By - Danieldms Answer Checked By - Terry (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.