We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Invalid values returned from cells using Accounting formatting

Hi,


The content of cell A1 in the first sheet contains the value 40. However Aspose Cells returns a Calendar for this cell. This happens when I change the formatting to Accounting and select the symbol CHF.

Thanks for looking into this.

Best regards

Ulf Ekström

Hi,

I think you may use Cell.getStringValue() or Cell.getDoubleValue() etc instead of directly using Cell.getValue() for your scenario, it works fine.

e.g


Workbook excel=new Workbook();
excel.open(“d:\files\Bok1.xlsx”);
Worksheets worksheets = excel.getWorksheets();
Worksheet worksheet = worksheets.getSheet(0);
//The results are commented here.
System.out.println(worksheet.getCells().getCell(“A1”).getStringValue());// 40.00 as string value
System.out.println(worksheet.getCells().getCell(“A1”).getDoubleValue()); //40.0
System.out.println(worksheet.getCells().getCell(“A1”).getValueType()); //2 ->DateTime
System.out.println(worksheet.getCells().getCell(“A1”).isDateStyle()); //true


Thank you.

Hi,


Thanks for your quick answer. However, we base our choice of method on the result of the getValueType-method, which returns DateTime. This is not a DateTime cell and therefore the method needs to be fixed.

Thanks and Best Regards,
Ulf

If I simply select a different currency, like $ in the accounting formatting option instead of CHF everything works as intended and a number is returned from the cell. It really shouldn’t be the case that the choice of currency will change the value type of the cell.


Regards,
Ulf

Hi,

Yes, we have found the invalid value returned for Cell.getValueType(). We will fix it soon.

Your issue has been logged into our issue tracking system with an issue id: CELLSJAVA-17355.

Thank you.

Hi,

Please try the attached version. We have fixed your issue.

Thank you.

Thanks,


Works perfect now.

Best regards,
Ulf

The issues you have found earlier (filed as 17355) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.