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

Free Support Forum - aspose.com

Locale-dependent date formatting not preserved when converting from �XML Spreadsheet 2003� format to XLSX format

Dear Aspose Support team,

I noticed that locale-dependent date formatting is not always preserved when converting from “XML Spreadsheet 2003” format to XLSX format using Aspose.Cells 8.6.2.

This is likely to be because I am not using Aspose correctly. I have searched the forums and found interesting related topics like :

http://www.aspose.com/community/forums/1/596836/problem-with-custom-date-formats-cell-of-xlsx-in-java/showthread.aspx

Date and number format mismatch for non-English locale
My original issue was that dates that were in Japanese format yyyy/mm/dd would appear as US format mm/dd/yyyy after conversion. I tried several combination of settings on the default locale, the workbook opening options, and the workbook options. I ended up with code like follows :
Locale.setDefault(Locale.JAPAN);

LoadOptions loadOptions = new LoadOptions();
loadOptions.setRegion(CountryCode.JAPAN);
loadOptions.setLocale(Locale.JAPAN);

Workbook wb = new Workbook(is,loadOptions);

wb.getSettings().setRegion(CountryCode.JAPAN);

wb.save(outputFile, SaveFormat.XLSX);

With this, the files generated by Aspose correctly show the dates in yyyy/mm/dd format.

But, I then noticed that my files are actually using a locale-dependent date format just identified as “Short Date” in the “XML Spreadsheet 2003” file. And I found that :

- before conversion, the date is indeed locale-dependent : shows yyyy/mm/dd on a PC setup to a Japanese locale, and shows dd/mm/yyyy on a PC with a UK locale.

- after conversion, the date loses its locale-dependent property : it always shows as Japanese yyyy/mm/dd, even with a UK locale. And surprisingly, when opening on a JP locale, Excel reports that the date is locale-dependant (format shown with a star in the formatting dialog), but when opening the same file on a UK locale, the format is identified as a fixed custom date format to always show yyyy/mm/dd (I will attach screenshots).

I used Aspose.Cells for Java 8.6.2, Excel 2010, and I ran the conversion on windows 7 with Java 1.8.0. I also observed the same with files converted on a Unix server (that is using the C locale).

I attached my sample file as well as screenshots of the behavior I observe.

Did I use Aspose incorrectly ? Is there a way to preserve the locale-dependent behavior of a date format after saving with Aspose.Cells ?

Also, are you able to observe the same behavior by converting the sample and opening with a locale that does not use yyyy/mm/dd ? For me, the converted file shows yyyy/mm/dd anyway, while the original xml adapts to my current locale automatically.

Thanks and regards,

Aspose.Cells User.




Hi,


Thank you for providing the detailed problem description.

We have evaluated the presented scenario while using the latest version of Aspose.Cells for Java 8.6.2.4, and we are able to notice the said problem, that is; locale dependent date format gets changed to fixed custom format. However, this issue occurs only when the system’s locale is Japan and corresponding formats have been set. Please check the attached snapshots for your reference, and note that Excel 2013 was used to verify this scenario.

We have logged an investigative ticket CELLSJAVA-41648 to look further into this matter. Please spare us little time for proper analysis. In the meanwhile, we will keep you posted with updates in this regard.

Hi,


This is to inform you that the ticket logged earlier as CELLSJAVA-41648 has been marked resolved. We will shortly share the fix here after ensuring the quality and incorporating other enhancements.

Hi,

Thanks for using Aspose.Cells.

We have fixed the issue CELLSJAVA-41648.

Please download and try the latest fix:
Aspose.Cells for Java v8.7.1.2 and let us know your feedback.

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


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