PHPExcel: Setting font size?

AnchovyLegend picture AnchovyLegend · Jan 9, 2013 · Viewed 52.6k times · Source

I have been looking to change the font size of some Excel cells using a PHP library called PHPExcel.

This is what I tried:

$objPHPExcel->getActiveSheet()->getStyle("F1:G1")->getFont()->setFontSize(16);

The method above does not work. I was wondering if anyone knows how to do this?

Many thanks in advance.

Answer

vvolkov picture vvolkov · Jan 9, 2013

Use setSize method instead setFontSize, it should work:

$objPHPExcel->getActiveSheet()->getStyle("F1:G1")->getFont()->setSize(16);