Get number format of a cell

May 23, 2008 at 8:47 AM
Is it true that I can only *set* a number format on a cell? No matter what format I applied to a cell (I tried Euro formatting, percentage, date, ...), I always get 'General':

  $coordinate = 'B1';
  echo 'Format ' . $coordinate . ': ' . $phpExcel->getSheet(0)->getStyle($coordinate)->getNumberFormat()->getFormatCode();

Shows 'General' for each cell of my test sheet (in which each cell has a different formatting)
May 23, 2008 at 1:19 PM
The default format is indeed "General". After setting it to a custom format, getFromatCode() will return your custom format.
May 23, 2008 at 2:24 PM
Now this is really stupid.
I accidentally left a '$reader->setReadDataOnly(true);' in my code!

I discovered it when I wanted to paste the whole script here :)