Wrong Date Custom Format (for Germany locale) gets returned


#1

Hello.

​We are running into an issue where Aspose.cells for Java is returning the wrong Date Culture Custom format to us. Please use the attached DateFormat_DE.xlsx workbook and the following code to print out the culture date formats.

You will see that the formats get returned is “TT.MM.JJJJ” while the expected format is “dd.MM.yyyy”.

​This issue is found in the version of 18.7 of Aspose.Cells for Java we are currently using as well as in the latest version of 18.11.

The same test case works fine in version of 17.6.3, where the date culture custom format “dd.MM.yyyy” is returned as expected.

We need this fixed in the Java version asap.

Thank you for your assistance.

public static void printDateCultureCustom() throws Exception{
    String dir = "C:/asposetest";
    Locale locale = new Locale("de");
    Workbook workBook = new Workbook(dir + "/DateFormat_DE.xlsx");
    workBook.getSettings().setLocale(locale);
    Worksheet sheet = workBook.getWorksheets().get(0);
    Cells cells = sheet.getCells();
    
    for(int i = 0; i < cells.getMaxDataRow()+1; i++){

        for(int j = 0; j < cells.getMaxDataColumn()+1; j++){
            Cell cell = cells.get(i, j);
            if(cell.getValue() != null) {
                System.out.println("Cell value: "+cell.getValue()+" Culture Custom: "+cell.getStyle().getCultureCustom());
            }
        }
    }
}

P.S. it doesn’t let me upload a file with an extension .xlsx. Is there an option to provide you a copy of the xlsx file that is used in the test code above?

DateFormat_DE.zip (6.3 KB)


#2

@ibmlittleton,

Thanks for the sample code and details.

We need your template file to evaluate your issue precisely. Please zip your template file and attach it here, we will check it soon.


#3

Hi Amjad,

Thanks for your prompt reply. I’ve attached the template file above in the post.

If anything else you need from my end, pls just let me know.

Thank you


#4

@ibmlittleton,

I have evaluated your scenario/ case a bit. I set German (Germany) regional/locale settings using the control panel and then opened your template file into MS Excel manually. I check the format of the cell, it shows “TT.MM.JJJJ” as custom format, see the screenshot for your reference:

so, I think Aspose.Cells is giving expected results.


#5

Hi @Amjad_Sahi,

Thanks for looking it into and get back to us.

The return of the format “TT.MM.JJJJ” breaks our existing date formatting logic.

In prior version e.g. version of 17.6.3 This custom format is returned as “dd.MM.YYYY” instead of “TT.MM.JJJJ”.

Can you please help in explaining why this change is introduced?

Thanks for your support.


#7

@ibmlittleton,

For CultureCustom, culture means it represents the culture depended custom pattern for formattings. However, it is hard for us to support all regions at a time. And the culture date patterns for some locales such as Italy were not supported in older versions. In recent versions we have supported some other locales for CultureCustom according to some other users’ scenario and requirement. To get the standard formatting pattern, please use Style.Custom instead of CultureCustom.