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

Free Support Forum - aspose.com

Getstringvalue date cell

Hi,

I am trying to read the sting value of a cell which in excel is in the format dd/mm/yyyy or is a text string like 1st January 2008. I’m using the getstringvalue() function. This is ok for the literal strings but returns a string in the format mm/dd/yyyy for the other cells.

I assume this is because aspose uses US dates? Is there anything which might help?

Thanks

Hi,

Which locale are you using? I have tried both dd/mm/yyyy and mm/dd/yyyy format, Aspose gave correct string corresponding with the date format. Would you please attach your template file here to show your issue? Thank you.

And for your situation, I think you can custom the style of such cell first, then get the string value, such as following:

Style style = cell.getStyle();
style.setCustom("dd/MM/yyyy");
cell.setStyle(style);
String strVal = cell.getStringValue();

Hi,

The cells are in UK format dd/mm/yyyy and visibly look like they are in this format. getstringvalue() seems to swap the dd and mm parts.

I will try out the custom style.

Thanks

Hi,

I have tested getStringValue() for cell of date format dd-mm-yyyy with locale UK and the result string was dd-mm-yyyy. Which version of Aspose.Cells for Java are you using? Would you please try our latest version 1.9.5.x to check whether it works fine? Thank you.

And was your template file created by MS Excels or by Aspose.Cells API? If the issue persists, please send us your template file and code here, thank you.