ExcelMapper: Convert double date values bug

When converting a cell double date value, the following code

https://github.com/mganss/ExcelMapper/blob/baa149f5dbf0221f4145a2f629b7e26c23fc0c94/ExcelMapper/ExcelMapper.cs#L567-L571

should return DateTime.FromOADate(cell.NumericCellValue) instead of cell.DateCellValue. The return of cell.DateCellValue causes an exception in the NPOI library. Here the Stack Trace:

Exception: Object reference not set to an instance of an object.

at NPOI.XSSF.UserModel.XSSFWorkbook.IsDate1904()
at NPOI.XSSF.UserModel.XSSFCell.get_DateCellValue()
at Ganss.Excel.ExcelMapper.GetCellValue(ICell cell, ColumnInfo targetColumn)
at Ganss.Excel.ExcelMapper.<Fetch>d__54.MoveNext()

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Thank you very much. That helps me a lot!