When I try to get the string value of Date Time,
in excel the data looks like - 2/15/2016
while reading the cell value using getValue - 2016-02-15T00:00:00
while reading the cell value using getStringValue- 2?15?
So how will I get the String Value whatever displayed in the cell. We are using aspose-cells-8.4.1.jar file
Hi,
Thank you for replying asap. Tried with latest jar
Hi,
Thanks for your quick reply. Here by I have attached the .xlsx file.
Hi,
Region - India
Hi,
Thanks for providing us further details.
After an initial test, I observed the issue as you mentioned. I found that Cell.getStringValue for DateTime type is giving undesired value as you pointed out. I even tried to set the region/locale but to no avail.
e.g
Sample code:
//Set the default locale
Locale.setDefault(new Locale(“in”, “INDIA”, “WIN”));
Workbook workbook = new Workbook(“Book.xlsx”);
//workbook.getSettings().setRegion(CountryCode.INDIA);
Worksheet worksheet = workbook.getWorksheets().get(0);
Cells cells = worksheet.getCells();
Cell cellA1 = cells.get(“A1”);
Cell cellB1 = cells.get(“B1”);
//A1 - 2/11/2016 9:01:00 PM
//B1 - 2/11/2016
System.out.println("Cell A1 getDisplayStringValue - " + cellA1.getDisplayStringValue());
System.out.println("Cell B1 getDisplayStringValue - " + cellB1.getDisplayStringValue());
System.out.println("Cell A1 getStringValue - " + cellA1.getStringValue());
System.out.println("Cell B1 getStringValue - " + cellB1.getStringValue());
System.out.println("Cell A1 getValue - " + cellA1.getValue());
System.out.println("Cell B1 getValue - " + cellB1.getValue());
Output:
Cell A1 getDisplayStringValue - 2/11/2016 21:01:00
Cell B1 getDisplayStringValue - 2?11?
Cell A1 getStringValue - 2/11/2016 21:01:00
Cell B1 getStringValue - 2?11?
Cell A1 getValue - 2016-02-11T21:01:00
Cell B1 getValue - 2016-02-11T00:00:00
I have logged a ticket with an id “CELLSJAVA-41737” for your issue. We will look into it soon.
Once we have an update on it, we will let you know here.
Thank you.
Thank you very much for your quick support.
Hi,
Thanks for using Aspose.Cells.
It is to inform you that we have fixed your issue CELLSJAVA-41737 now. We will soon provide the fix after performing QA and including other enhancements and fixes.
The issues you have found earlier (filed as CELLSJAVA-41737) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
Appreciate for your timely help. Thank you very much to Aspose Cells Team.
Hi,