shuchkin / simplexls

Parse and retrieve data from old format Excel XLS files. MS Excel 97 workbooks PHP reader.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong translation of negative number

fluca1978 opened this issue · comments

Found in an excel 97 file that a numeric cell, formatted as number 0,00 if negative and lower than -2 gets interpreted badly, seems an overlflow in the IEEE754 code.
I placed a value of -3,15 that is not working:

  • _GetInt4d returns 4294966039 out of byte values 23, 64256, 16711680, 4278190080
  • _IEEE754 returns then 1073741509
  • the number is finally translated to 10737415,09

The cell is interpreted as of type MULRK, and changing the formatting to even text does not solve the problem.
If the cell is expressed as a formula =-3,15 the parsing is fine.
Positive values of the same cell work fine.

Apparently is a sign problem, since every negative number different from -1 is conerted to a very high positive number.

As a sidenote, the PHPOffice reader can translate the same cell correctly, but without the sign.
I don't see however the difference in the byte sequence extraction.

Great, it seems to work with negative numbers now!
Thanks.