替换核算单元

parent e4c901e6
......@@ -7,6 +7,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
namespace Performance.Services.ExtractExcelService
{
......@@ -86,6 +87,22 @@ public static void SetCellValue<T>(this ICell cell, object value, T defaultValue
cell.SetCellValue("");
}
}
public static void SetValue(this ISheet sheet, int row, int column, object value)
{
var icell = sheet.GetOrCreate(row).GetOrCreate(column);
switch (value)
{
case string reg when Regex.IsMatch(reg, @"^[+-]?\d*[.]?\d*$"):
value = ConvertHelper.To<double>(value);
break;
case string reg when Regex.IsMatch(reg, @"^[+-]?\d*$"):
value = ConvertHelper.To<int>(value);
break;
}
SetCellOValue(icell, value);
}
public static void SetCellOValue(this ICell cell, object value)
{
......
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