Topics: Developer Forum
Mar 16, 2015 at 5:39 PM
Cell value 3,53. Cell format 3,53USD.
I want to get cell format by using:

$format = $objWorksheet->getStyleByColumnAndRow($col, $row)->getNumberFormat()->getFormatCode();

But nevertheless no matter what cell format the result is:
string(7) "General"

The question is how can I get USD or something contains USD to work with it by regular expressions.
Thank you!
Mar 16, 2015 at 6:28 PM
Edited Mar 16, 2015 at 6:29 PM
Where does 3,53USD come from? Is this a value returned by getFormattedValue()? Is 3.53USD a calculated value?

Is this data being read from an existing spreadsheet? If so, are you using loadDataOnly?
Mar 16, 2015 at 7:30 PM
Thank you so much!
I have just used getFormattedValue() without using loadDataOnly() and get 3,53USD !
Yes, the data is being read from an existing spreadsheet. But getFormatCode() still return string(7) "General"
Mar 16, 2015 at 7:41 PM
Completely stumped, unless the cell value is a string.... but I'm completely unable to explain where the USD comes from, only to say that it simply cannot be!

If getFormatCode() returns "General" then getFormattedValue() should return exactly the same result as getValue(), which means that a cell value of 3,53 (as returned by a call to getValue()) should return 3,53 from getFormattedValue() as well.... however, 3,53 is not a number but a string.... a number would have a decimal (.) not a decimal (,).