Value not as expected

I am using Aspose.Cells 7.5.3.3 with Jdk 6.


I have attached a sample excel file which has a column of data.

Workbook book2 = new Workbook(“E:\xls\testtank.xls”);
Worksheet mySheet = book2.getWorksheets().get(0);

Cells myCells = mySheet.getCells();
int col = 24;

for (int row = 0; row < 400; row++) {
String myValue = myCells.get(row, col).getDisplayStringValue();
LOG.debug("Value --> Row:Col - " + (row) + “:” + col + “, value - [” + myValue + “]”);
}

In the excel file:
Y345 = 29/10/1994
Y346 = 30/10/1994

But then I read the values in the loop above I get Y346 = 29/10/1994 instead of 30/10/1994

Is there something I am doing incorrectly?

Hi Steven,

Thanks for your posting and using Aspose.Cells for Java.

Please download and use the latest version: Aspose.Cells
for Java v7.5.3.5
. It works fine.

We have tested your issue with the following code and it gives correct value. i.e 30/10/1994 for cell Y346.

Java


Workbook book2 = new Workbook(“F:\Shak-Data-RW\Downloads\testtank.xls”);

Worksheet mySheet = book2.getWorksheets().get(0);


Cells myCells = mySheet.getCells();


Cell cell = mySheet.getCells().get(“Y346”);


System.out.println(cell.getStringValue());

Hi Shakeel,

I tried the test with 7.5.3.5 and I still get 29/10/1994 instead of 30/10/1994.
I put the value in a different cell, ie. A3, and get the same error. Is it a locale issue?

Cell cell = mySheet.getCells().get("Y346");
System.out.println(cell.getStringValue());
System.out.println(cell.getValue());

Output:

29/10/1994
1994-10-30T00:00:00

The date extracted seems to be correct.

Regards,

Steven.

Hi Steven,


I tested your scenario using the following code with Aspose.Cells for Java v7.5.3.5 using your attached template Excel file and it works fine.
I use English (US) settings.

Here is my sample code:

Sample code:

Workbook book2 = new Workbook(“testtank.xls”);

Worksheet mySheet = book2.getWorksheets().get(0);


Cells myCells = mySheet.getCells();


Cell cell = mySheet.getCells().get(“Y346”);


System.out.println(cell.getStringValue());
System.out.println(cell.getValue());
System.out.println(cell.getDisplayStringValue());



Output:
30/10/1994
1994-10-30T00:00:00
30/10/1994

Thank you.

Hi Amjad,


So how do I resolve this issue? The locale of that cell is “English (Australia)”.
This seems to only happen for this date and not the others; all the other dates are read correctly.


Steven.

Hi Steven,

Thanks for your posting and using Aspose.Cells for Java.

We have tried the English (Australia) Locale settings but did not find any issue. Could you try the English (USA) locale settings and see if it resolves your issue? We have logged this issue in our database for investigation. We will look into it and fix this issue if possible. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSJAVA-40637.

Hi Steven,

Thanks for using Aspose.Cells for Java.

We have looked into your issue further and we are unable to replicate it. We have tested it with English(Australia) locale with JDK6(1.6.0_04-b12) and JDK7(1.7.0-b147), all gave the correct result: 30/10/1994.