Double (10525000.0) turns into an Integer

Hi,


We are using Aspose Cells version 2.4.3 and are experiencing a very strange issue. The following test program prints java.lang.Integer (should be java.lang.Double).

Workbook book = new Workbook();
book.getWorksheets().getSheet(0).getCells().getCell(0,0).setValue(10525000.0);

book.save(new FileOutputStream(“test.xls”));

book = new Workbook();
book.loadData(new FileInputStream(“test.xls”));

System.out.println("Class: " + book.getWorksheets().getSheet(0).getCells().getCell(0,0).getValue().getClass());


However, if we run the same program with a smaller input value like 100.0 (or even a higher like 20000000.0) a double value is correctly returned. What is so special about 10525000.0? We should always get the same type of object back.

If we call the following line:
System.out.println("Class: " + book.getWorksheets().getSheet(0).getCells().getCell(0,0).getValue().getClass());

before we save and reload the file a Double is always returned, but something goes wrong during the save or load operation.

Thanks & Best Regards,
Ulf Ekström

Hi Ulf,

We are working on this issue. We will update you soon.

Thanks,

Hi Ulf,

We are able to reproduce the issue mentioned by you. The issue has been logged with ID CELLSJAVA-22313. We are working on this issue. We will update you soon.

Thanks,

<!–[if gte mso 10]> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–>

Hi,


We have analyzed your issue. For the value type of cell value, it is not a bug in fact. The type we provide to you is just the value type which is actually saved in xls. Even you input such 3 values in Excel, the value record for them saved in the xls are different. What kind of record saved for double values depends on the value's precision and range. We think you can treat all numeric values as double, or you can check whether one double value equals to corresponding integer value by yourself if type INTEGER and DOUBLE have significant difference for your situation.

Thank you.

Ok, thanks.


Best Regards,
Ulf