NPOI 导入excel 的 奇葩有关问题
NPOI 导入excel 的 奇葩问题
使用NPOI 导入excel 相同 的代码 导入 不同 的excel 时 数据 不一致
两个 excel 结构 是相同 的

这是 第一个 excel 数据源

这是 第一个 excel 数据源 导入时 转换 dt 之后的数据

这是 第二个 excel 数据源

这是 第二个 excel 数据源 转换 dt 之后的数据
相同 的代码 读取 两个 excel 时 数据 出现 问题 是什么原因呢
------解决方案--------------------
资源被删了
------解决方案--------------------
看了一下,代码写的超复杂
GetValueTypeForXLSX封装好了怎么不用呢,用它来直接判断单元格类型,对应的读,而不是根据列名写死.
那同一列的不同行,有的是数字,有的是文本,不出错才怪.
使用NPOI 导入excel 相同 的代码 导入 不同 的excel 时 数据 不一致
两个 excel 结构 是相同 的
这是 第一个 excel 数据源
这是 第一个 excel 数据源 导入时 转换 dt 之后的数据
这是 第二个 excel 数据源
这是 第二个 excel 数据源 转换 dt 之后的数据
相同 的代码 读取 两个 excel 时 数据 出现 问题 是什么原因呢
------解决方案--------------------
资源被删了
------解决方案--------------------
看了一下,代码写的超复杂
GetValueTypeForXLSX封装好了怎么不用呢,用它来直接判断单元格类型,对应的读,而不是根据列名写死.
那同一列的不同行,有的是数字,有的是文本,不出错才怪.
if (cell == null)
return null;
switch (cell.CellType)
{
case CellType.Blank: //BLANK:
return null;
case CellType.Boolean: //BOOLEAN:
return cell.BooleanCellValue;
case CellType.Numeric: //NUMERIC:
return cell.NumericCellValue;
case CellType.String: //STRING:
return cell.StringCellValue;
case CellType.Error: //ERROR:
return cell.ErrorCellValue;
case CellType.Formula: //FORMULA:
switch (cell.CachedFormulaResultType)
{
case CellType.Blank: //BLANK:
return null;
case CellType.Boolean: //BOOLEAN:
return cell.BooleanCellValue;
case CellType.Numeric: //NUMERIC:
return cell.NumericCellValue;
case CellType.String: //STRING:
return cell.StringCellValue;
case CellType.Error: //ERROR:
return cell.ErrorCellValue;
default: