标签:switch excel lua ice eva class etc ble row
ICell cell = row.GetCell(j); if (!cell.isDbNullOrNull()) { switch (cell.CellType) { case CellType.Blank: dataRow[j] = string.Empty; break; case CellType.Boolean: dataRow[j] = cell.BooleanCellValue; break; case CellType.Numeric: if (DateUtil.IsCellDateFormatted(cell))//日期 { dataRow[j] = cell.DateCellValue; } else { dataRow[j] = cell.NumericCellValue; } break; case CellType.String: dataRow[j] = cell.StringCellValue.Trim(); break; case CellType.Error: dataRow[j] = cell.ErrorCellValue; break; case CellType.Formula://公式 try { HSSFFormulaEvaluator e = new HSSFFormulaEvaluator(cell.Sheet.Workbook); e.EvaluateInCell(cell); dataRow[j] = cell.ToString(); } catch { if (DateUtil.IsCellDateFormatted(cell))//日期 { dataRow[j] = cell.DateCellValue; } else { dataRow[j] = cell.NumericCellValue; } } break; default: dataRow[j] = cell.ToString(); break; } }
标签:switch excel lua ice eva class etc ble row
原文地址:https://www.cnblogs.com/itclw/p/9272959.html