风光大葬
This commit is contained in:
@@ -7,7 +7,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ramitta
|
||||
namespace Ramitta.Excellib
|
||||
{
|
||||
public static class Excel
|
||||
{
|
||||
@@ -165,5 +165,27 @@ namespace Ramitta
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static ICell? getRowCell(ISheet sheet, int rowIndex, int cellIndex)
|
||||
{
|
||||
IRow row = sheet.GetRow(rowIndex);
|
||||
if (row == null) return null;
|
||||
|
||||
ICell cell = row.GetCell(cellIndex);
|
||||
if (cell == null) return null;
|
||||
|
||||
return cell;
|
||||
}
|
||||
public static String? getRowCellStr(ISheet sheet, int rowIndex, int cellIndex)
|
||||
{
|
||||
var cellValue = getRowCell(sheet, rowIndex, cellIndex)?.ToString();
|
||||
return string.IsNullOrWhiteSpace(cellValue) ? null : cellValue;
|
||||
}
|
||||
|
||||
// 简短版本
|
||||
public static int ColToIndex(string col)
|
||||
{
|
||||
return col.ToUpper().Aggregate(0, (cur, ch) => cur * 26 + (ch - 'A'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user