Different date format when compared to Excel

Hello,


I am currently evaluating Aspose.Cells for java and I’ve found a difference in its behaviour when compared to Excel. When I run the following code:

public static void main(String[] someArgs) throws Exception
{
Workbook myWorkbook = new Workbook(“test/Test02.xls”);
myWorkbook.getSettings().setCalcMode(CalcModeType.MANUAL);

System.out.println(myWorkbook.getWorksheets().get(0).getCells().get(0, 0).getStringValue());
myWorkbook.calculateFormula();
System.out.println(myWorkbook.getWorksheets().get(0).getCells().get(0, 0).getStringValue());
System.out.println(myWorkbook.getWorksheets().get(0).getCells().get(0, 0).getDisplayStringValue());
}

On the attached xls spreadsheet (which contains in cell Sheet1!A1 a date formatted as ‘Wednesday, 30 June 10’ - see png attachment) I get the following output:

30 June 2010
30 June 2010
30 June 2010

Basically the format of the date in the spreadsheet is different when extracted using getStringValue() or getDisplayStringValue().

Hi,


I can notice the issue after using your shared sample code with your template file. I think your locate is English (GB). Here is the console output:

30 June 2010
30 June 2010
30 June 2010

I have logged a ticket with an id “CELLSJAVA-40477” for your issue. We will look into your issue soon.

Once we have any update on it or we sort your issue out, we will let you know here.

Thank you.

Hi,

The region settings saved in your template file is en_GB. Please set the region to one with default long date format as you expect, such as en_US. You may add one line of code after loading the template file to sort your issue out:

myWorkbook.getSettings().setRegion(CountryCode.USA);

Thank you.