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

Free Support Forum - aspose.com

java.lang.NumberFormatException: For input string: "0-0010"

Hi,

here is may issue:

Environment :

client = Windows 7 / Excel 2007 / java 1.6 /

Serveur = Unix / Tomcat 7.0.37 / java 1.6 / Aspose Cells 7.3.1

the process import values stored in .xlsm files by 3 steps :

- upload .xlsm file on the serveur

- check validity of .xlsm file whith Aspose Cells by

wb = new Workbook(file) / check values / log check / wb.save(file)

- import values from the .xlsm by

wb = new Workbook(file) / log.import / wb.save File

The issue is, when the file is opended for the second time after check step and wb.save(file) ther is the exception "For input string "0,0010".

No "0,0010" value in my file (attached below).

same problem with Aspose Cells 7.7.2

No more problem with Aspose Cells 8.2.1. But I can't use this version because the impact of the whole app :

in Aspose Cells 7.3.1, all number cells where "Double" and in the whole app, all nubers are casted whith Double.

In Aspose Cells 8.2.1, the type of a number cell depends of is value ... Integer for integer value or Double for decimal value ...

Could you help me.

Thanks in advance.

Regards

Eric HAMEL

Hi Eric,

Thanks for your posting and using Aspose.Cells.

We were not able to replicate your mentioned issue with the latest version: Aspose.Cells for Java 8.2.2. We opened your file and saved it using Aspose.Cells and it did not generated any exception.

Please let us know your run results with the latest version. If your issue still occurs, then please provide us your runnable sample code replicating the exception and the source Excel files used in your code. We will investigate it by running it our end and log it in our database if we found any bug.

Please provide us a simplest code which should not be more than few lines because it will help us replicating and fixing the issue more rapidly.

Please note, we do not provide fixes to older versions, we only provide fixes based on the latest versions only. So if the issue is not replicated with the latest version, then it means it is already fixed, so you need to use the latest version in that case. In case, the issue still occurs with the latest version, we will provide a fix for it in next versions.

Hi Shakeel,

I know that the issue is fixed with Aspose.Cell 8.2.2. I tried it and it was OK.

But as i told you before, we can't install the lastest version for this application because of many impacts on casting cells in the whole application.

And for the moment, we don't have enough time and team to fix all the impacts.

And our client will not pay for code modification due to Aspose upgrade.

I hoped that you could tell me what's wrong with this particular xlsm file on Apsose Cells 7.7.2.

Most of xlsm files are OK; But some of them, like this one, throw an exception when you open it whith aspose.cells after save with aspose.cell.

what is killing me is you can't : open with aspose - save with aspose - open with aspose -> exception

but : open with aspose - save with aspose - open with excel - save with excel - open with aspose -> OK

If you could just tell me whats wrong with this file, just to avoid it, will be kind.

Regards

Eric HAMEL

Hi Eric,

Thanks for your posting and using Aspose.Cells.

We were able to observe the exception after executing the following code using the older version (v7.2.2), the latest version works fine though.

We have logged this issue in our database for investigation. And we will let you know why this exception occurred and what you could do to avoid the exception.

This issue has been logged as

  • CELLSJAVA-41058 - java.lang.NumberFormatException: For input string: "0,001"

Java

String filePath = “F:\Shak-Data-RW\Downloads\Profiles_Fichier+banalis%c3%a9_Fuel+gas_07_10_14_14.50.19.xlsm”;


Workbook workbook = new Workbook(filePath);

Exception:
Exception in thread “main” java.lang.NumberFormatException: For input string: “0,001”
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at java.lang.Double.parseDouble(Unknown Source)
at com.aspose.cells.b.a.o.a(Unknown Source)
at com.aspose.cells.ahs.E(Unknown Source)
at com.aspose.cells.aal.f(Unknown Source)
at com.aspose.cells.aal.a(Unknown Source)
at com.aspose.cells.aaj.h(Unknown Source)
at com.aspose.cells.aaj.a(Unknown Source)
at com.aspose.cells.aai.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.(Unknown Source)
at ClsAsposeTest.f1(ClsAsposeTest.java:399)

Hi,


We have evaluated your issue further. For your issue “CELLSJAVA-41058”, it is caused by the fact that this file’s calculation setting of Iteration is
true and the value of “Maximum change” to be saved as localized string by old
versions of cells component. When the decimal separator is ‘,’ instead of ‘.’,
this error will be caused by it. To solve it with the old versions, there are two
options:

One is to change the default locale of the Java application to one whose decimal separator is '.', such as en-US.

e.g

Sample code:

Workbook workbook = new Workbook(...);

...

Locale.setDefault(Locale.US);

...

workbook.save(resultfile);

workbook = new Workbook(resultfile);

...

Another option is to set the Iteration setting as false before saving the workbook:

e.g

Sample code:


Workbook workbook = new Workbook(...);

...

workbook.getSettings().setIteration(false);

...

workbook.save(resultfile);

workbook = new Workbook(resultfile);

...



Thank you.

Hi,

Thanks for logging the issue, investigations and providing me a solution to avoid the exception.

I will implement the second solution and let you know if it's OK.

Regards,

Eric HAMEL

Hi Eric,

Thanks for your posting and using Aspose.Cells.

Hopefully, the solution provided by us will enable you to use the older version without any issue. In case, you find any other question or face any other issue, please feel free to post on our forums, we will be glad to look into it and help you asap.