getDefaultStyle() deprecated

Topics: Developer Forum
Jan 18, 2013 at 8:45 AM

Hi, I am new to PHPExcel.

$objPHPExcel->getDefaultStyle()->getFont()
    ->setName('Arila')
    ->setSize(10);

How do I set the default font for the whole worksheet? The solution with getDefaultStyle() works, but the new version of PHPExcel (1.7.8) says that getDefaultStyle() is deprecated. Unfortunately, neither the API nor Google has been able to help me find an alternative way to set the font size for an entire worksheet without using getDefaultStyle().

Any ideas? 

PHP 5.4.6

Ubuntu 12.10

Coordinator
Jan 23, 2013 at 10:44 AM

$objPHPExcel->getDefaultStyle()->getFont()
    ->setName('Arila')
    ->setSize(10);

Sets a default style for the whole workbook (all worksheets).

 

It is the worksheet's getDefaultStyle() method that has been deprecated, because all that it actually does is set the workbook default style, and this could lead to confusion if people believe that they can have default styles for each individual worksheet within a workbook.

The workbook getDefaultStyle() method hasn't been deprecated.

Jan 24, 2013 at 3:54 PM

Thanks for the explanation.