Date value detection

Hi,


12.01.2016 is not recognised as date under default locale settings. What should be done to detect it as a date value ?




Hi,

Thanks for your posting and using Aspose.Cells.

First you need to know what Locale suits your date format. I found, Germany locale suits it. Then you can set the workbook locale using the Workbook.getSettings().setLocale() method.

Please see the following code for your needs. I have also attached the output excel file generated by it for your reference.

Java
Workbook wb = new Workbook();

wb.getSettings().setLocale(Locale.GERMANY);

Worksheet ws = wb.getWorksheets().get(0);

Cell c = ws.getCells().get(“A1”);

c.putValue(“12.01.2016”, true);

Style s = c.getStyle();
s.setCustom(“dd/mmm/yyyy”);
c.setStyle(s);

ws.autoFitColumn(0);

wb.save(“output.xlsx”);


Thanks for the reply.


But I don’t have access to the file. I created a workbook using the inputstream but not absolute file path. What should be done in this case ? Also in the xlsx workbook 12.01.2016 is considered as date using format cells. Is it possible to get it detected as date by aspose without locale setting changes ?

Hi,

Thanks for your posting and using Aspose.Cells.

Please share the screenshot of your excel file in the Microsoft Excel and share your sample excel file with us so that we see how the date looks at your end and at our end. Please also let us know your Region and Language settings as shown in the screenshot. Please also share your sample code with us. We will look into your issue and help you asap.