Hi,
I am using aspose cells 23.4 and am currently investigating a possibility to process excel files using different regional parameters. I am seeing differences between how aspose and excel displays some values. A simple code example would be this:
Workbook workbook = new Workbook(new FileInputStream("C:\\path\\to\\region test.xlsx"), new LoadOptions());
workbook.getSettings().setRegion(CountryCode.HUNGARY);
workbook.getSettings().setLocale(new Locale("hu", "HU"));
Cell cell0 = workbook.getWorksheets().getRangeByName("range1").get(0,0);
Cell cell1 = workbook.getWorksheets().getRangeByName("range1").get(0,1);
Cell cell2 = workbook.getWorksheets().getRangeByName("range1").get(0,2);
String currency = cell0.getStringValue();
String longDate = cell1.getStringValue();
String shortDate = cell2.getStringValue();
I tried various regions and locales, but I don’t always get an expected result for the variables currency
, longDate
and shortDate
(I expect them to be the same as in excel with regional setting applied).
For example, in case of the shown code snippet, the values of the variables are:
currency = $30 004 569,00 longDate = 2013. március 14. shortDate = 3/10/2013
However, if unmodified Hungarian regional setting is applied on Windows, excel displays these values slightly differently:
currency = Ft30 004 569,00 longDate = 2013. március 14., csütörtök shortDate = 2013.03.10
Another example would be Finnish:
Aspose:
currency = $30 004 569,00 longDate = 14. maaliskuutata 2013 shortDate = 10.3.2013
Excel:
currency = €30 004 569,00 longDate = torstai 14. maaliskuu 2013 shortDate = 10.3.2013
Here the short date is processed correctly, but the currency and long date are still different. What I noticed is that for most of the country codes the currency is not converted. The date inconsistencies are not as often.
I attached the file used in the example. Would like to know whether a fix for this could be expected or the behavior is as expected. region test.zip (6.5 KB)
.