Wrong cell type detection in Aspose.Cell

Reading in an Excel file with custom number format is treated as a timestamp instead of number. Attached example file will show the bug. Number format is set to D-##### for German zip code but returned as a timestamp.

Hi,


Thanks for providing us template file.

Could you provide us your sample code to evaluate your issue on our end.

I have tested with the following code using v8.1.0.x, it reads correct value(s):
e.g
Sample code:

Workbook workbook = new Workbook(“test.xlsx”);
Worksheet ws = workbook.getWorksheets().get(0);
Cells cells = ws.getCells();

System.out.println(cells.get(“A1”).getStringValue());
System.out.println(cells.get(“A1”).getDisplayStringValue());

Thank you.

Hi there,

this is the code:


Iterator allRows = sheet.getCells().getRowEnumerator();
while(allRows.hasNext()) {
Row row = (Row)allRows.next();

Cell cell = row.get(i);
if(cell.getType() == CellValueType.IS_DATE_TIME) {
//entering this condition on custom formatted cells :frowning:
Date date = cell.getDateTimeValue().toDate();

} else …

Regards,

Steffen

Hi Steffen,

Thanks for your posting and using Aspose.Cells.

We were able to observe this issue after running the following code using your sample file with the latest version: Aspose.Cells
for Java v8.1.0.2
. We found that Aspose.Cells is detecting the number as date time.

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged CELLSJAVA-40862.

Java


Workbook workbook = new Workbook(“test.xlsx”);

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

Cells cells = ws.getCells();


System.out.println(cells.get(“A1”).getStringValue());

System.out.println(cells.get(“A1”).getDisplayStringValue());


Cell cell = cells.get(“A1”);


System.out.println(cell.getType() == CellValueType.IS_DATE_TIME);

Console Output:
D-12345
D-12345
true

Hi,


Please try our latest fix/ version: Aspose.Cells for Java v8.1.0.3

We have fixed your issue now.

Let us know your feedback.

Thank you.

works perfectly! Thanks for the great job.

Hi,


Good to know that your issue is resolved by the new fix/version. Feel free to to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Thank you.

The issues you have found earlier (filed as CELLSJAVA-40862) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.