if (cell.CellType == CellType.Numeric)
{
note: you need to use wb = WorkbookFactory.Create(filestream,ImportOption.All); ImportOption.All parameter allows DateUtil.IsCellDateFormatted to work properly.
{
object[targetRowNum, targetColNum] = cell.NumericCellValue.ToString();
if (DateUtil.IsCellDateFormatted(cell))
{
object[targetRowNum, targetColNum] = cell.DateCellValue.ToString("dd-MMM-yyyy");
}
}note: you need to use wb = WorkbookFactory.Create(filestream,ImportOption.All); ImportOption.All parameter allows DateUtil.IsCellDateFormatted to work properly.