poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dejan ikodinovic <dejan.ikodino...@gmail.com>
Subject Apache POI
Date Wed, 12 Sep 2018 09:31:52 GMT
Hi guys,

I m working on parsing Excel xlsb files using Apache POI 3.17 version and
have problem for some numbers.
The problem is reading some numbers with 7 - 9 digits result as 0. This is
not the case for all 7 - 9 digits numbers.

for numbers like
1000000, 10000000, 1880000, 1880400 it works correct, but one example where
I get 0 is *1880450*.

---------------------------------- *GOOD *
-------------------------------------
With debug I found for *1880400* read as byte array
[0, 0, 0, 0, 80, -79, 60, 65]

this is correct I also checked with java code as:

System.out.println(
    ByteBuffer.wrap(new byte[] { 65, 60, -79, 80, 0, 0, 0, 0 })
        .getDouble());

and it outputs 1880400.0

also when read bytes like

ByteBuffer.allocate(8).putDouble(1880400).array()

[65, 60, -79, 80, 0, 0, 0, 0]
same as with *XSSFBParser*

---------------------------------- *BAD*
-------------------------------------

but *XSSFBParser* when read bytes for *1880450* returns array
[0, 0, 0, 0, 10, -58, 114, 0]

and when I check with

ByteBuffer.allocate(8).putDouble(1880450).array()

[65, 60, -79, -126, 0, 0, 0, 0]
and this is correct byte array, but we dont get these bytes when read from
InputStream

I guess this wrong read bytes comes from

LittleEndianInputStream in XSSFBParser

Just to mention that I saw you've released new Version 4.0.0 and tried it
as well and problem still exists. It reads 0 value for 1880450.

Any idea (advice, help) what could be problem and how I can fix this?
Many thanks in advance!!!

Cheers,
Dejan

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message