How can I set the global font size?

Aug 2, 2009 at 3:11 AM
Edited Aug 2, 2009 at 3:24 AM

How can I set the font size for an entire sheet instead of just a single cell? I downloaded the latest code attempting to fix the problem protecting cells and now the default font size is larger and I'd like to reduce it across the entire sheet, not just a single cell.

Much thanks

Sorry, found this one in the docs. Should have been reading a bit more thourourghly.

Aug 2, 2009 at 1:20 PM

Yup, latest source code differs a bit from PHPExcel 1.6.7. You solved the problem, but I will explain some more for others.

In the upcoming PHPExcel 1.7.0 we have full control over the default style for the workbook. This includes the font used for row numbers 1,2,3 and column letters A,B,C.


In MS Office Excel 2007, I do not know of a way to change the default font for a workbook. All you can do is to alter font settings in your preferences, and those settings will then be used as the default font in future workbooks that you create.

Moreover, in the Excel file format it is not possible to have different fonts for 1,2,3,..., A,B,C,... in the various sheets. Therefore getDefaultStyle() is now attached to the PHPExcel object rather than to the sheets. There was some confusion about this concept in PHPExcel 1.6.7, but hopefully it is straightened out now.

Jan 17, 2013 at 3:09 PM
Edited Jan 18, 2013 at 9:40 AM


Nov 27, 2013 at 8:28 AM
hello every body!
I want to import data from excel file to mysql database.
How I cant get format font-size, color... in excel file to do switch to html code before import to database?
I'm try to searched google, but not have a result able :(
thanks for help!
Nov 27, 2013 at 11:57 AM
Look at the different methods proposed by the PHPExcel_Style_Font object, you get by $objWorksheet->getStyle('A1')->getFont().
Things may be complicated if you have Rich Text, if conditional formats are applied...