修复0读取BUG

parent 464215c5
...@@ -10,6 +10,29 @@ namespace Performance.Services ...@@ -10,6 +10,29 @@ namespace Performance.Services
{ {
public class NopiSevice public class NopiSevice
{ {
public static string GetCellStringValue(ICell cell)
{
if (cell != null)
{
try
{
switch (cell.CellType)
{
case CellType.Numeric:
return cell.NumericCellValue.ToString();
case CellType.String:
return cell.StringCellValue.ToString();
case CellType.Formula:
return cell.NumericCellValue.ToString();
}
}
catch (Exception ex)
{
//throw ex;
}
}
return null;
}
public static decimal? GetCellValue(ICell cell) public static decimal? GetCellValue(ICell cell)
{ {
if (cell != null) if (cell != null)
......
...@@ -73,8 +73,8 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -73,8 +73,8 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{ {
RowNumber = r, RowNumber = r,
SignID = athead.SignID, SignID = athead.SignID,
AccountingUnit = row.GetCell(unit.AccountingUnitCellNum.Value)?.StringCellValue, AccountingUnit = NopiSevice.GetCellStringValue(row.GetCell(unit.AccountingUnitCellNum.Value)),
Department = row.GetCell(unit.DeptCellNum.Value)?.StringCellValue, Department = NopiSevice.GetCellStringValue(row.GetCell(unit.DeptCellNum.Value)),
TypeName = athead?.CellValue, TypeName = athead?.CellValue,
CellValue = cellValue, CellValue = cellValue,
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String, Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment