Reading a currency value from Excel file

Hi,


Im trying to read a cell value that contains currency value (Eg : $123.00) using aspose_cells.

cell.getStringValue() returns a value $ 123.00 i.e a space is inserted between the currency symbol and the number.

Why is this space in between?

Is there any other way that i can follow to get the proper value without space.

Hi Praba,

Thank you for contacting support.

I am afraid, I am unable to replicate your presented scenario on my end while using the latest version of Aspose.Cells for Java 7.7.2.4 and a sample spreadsheet of my own. Please check the attached snapshot of the output in Eclipse console. You may notice that the output string retrieved through Cell.getStringValue() and Cell.getDisplayStringValue() does not contain the space between the currency symbol and the value, as mentioned in your post. I would request you to please give the latest version a try at your end. In case the problem persists, please provide your sample spreadsheet as well as the complete code snippet for our review.

Hi,


Actually im using the version 7.7.0. Can you confirm with that version and tell whether the issue happens with that version as i cant use the version 7.7.2 which says “The subscription included in this license allows free upgrades until 2014-02-16, but this version of the product was released on 2014-03-07. Please renew the subscription or use a previous version of the product”.

Thanks,
Praba

Hi Praba,

Thank you for writing back.

I have re-evaluated your presented scenario while using Aspose.Cells for Java 7.7.0, and have got same results as of shared in my previous reply. Attached is my sample spreadsheet for your reference. In case the problem persists, please provide your sample spreadsheet for our review along with code snippet that you are using on your end. Please also mention the target JDK version so we could replicate the environment on our end to re-evaluate the said problem.

The subscription included in this license allows free upgrades until 2014-02-16, but this version of the product was released on 2014-03-07. Please renew the subscription or use a previous version of the product

The above message is in reference to the subscription expiry, that will not let you use the latest versions ( 7.7.2.x) without renewing the subscription.

Hi,


I have tried reading a newly created file with currency value. It is read properly. But the problem occurs in the file that i have attached. And im using java version 1.6. Kindly heck the file.

Thanks,

Hi Praba,


Thank you for providing the sample file.

We are able to replicate the said problem on our end while using the latest version of Aspose.Cells for Java 7.7.2.4 with below provided code snippet.

Java

Workbook book = new Workbook(myDir + “Sales_HiddenRows.xls”);
Cells cells = book.getWorksheets().get(0).getCells();
for(int i=2; i<=10; i++)
{
String cell = “E”+i;
System.out.println(cell + " getStringValue() :"+cells.get(cell).getStringValue());
System.out.println(cell + " getDisplayStringValue() :" + cells.get(cell).getDisplayStringValue());
}

Output

E2 getStringValue() :$ 123.00
E2 getDisplayStringValue() : $ 123.00
E3 getStringValue() :$ 400.00
E3 getDisplayStringValue() : $ 400.00
E4 getStringValue() :$ 540.00
E4 getDisplayStringValue() : $ 540.00
E5 getStringValue() :$ 345.00
E5 getDisplayStringValue() : $ 345.00
E6 getStringValue() :$ 524.00
E6 getDisplayStringValue() : $ 524.00
E7 getStringValue() :$ 678.00
E7 getDisplayStringValue() : $ 678.00
E8 getStringValue() :$ 465.00
E8 getDisplayStringValue() : $ 465.00
E9 getStringValue() :$ 300.00
E9 getDisplayStringValue() : $ 300.00
E10 getStringValue() :$ 450.00
E10 getDisplayStringValue() : $ 450.00

We have logged a ticket CELLSJAVA-40764 in our bug tracking system for further investigation and correction purposes. Please spare us little time to properly analyze the problem cause on our end. In the meanwhile, we will keep you posted with updates in this regard.

Hi,


Please try the latest version/fix: Aspose.Cells for Java v7.7.2.6

We have made Cell.StringValue to be same with what you can get from MS Excel when copying a cell as text ( such as copy a cell to text editor or exporting CSV). Please try the new fix and let us know your feedback.



Thank you.

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.