在使用XSSFWorkbook读取excel时读到-130时会出现”-D5“,”F5“,一直不明白啥原因,后边发现需要再做一次转换才行
var row = sheet.GetRow(rowIndex);
for (int j = 0; j < header.LastCellNum; j++)//横
{
var cell = row.GetCell(j);
if (cell != null)
{
string data;
if (cell.CellType == CellType.Formula)
{
if (cell.CachedFormulaResultType == CellType.Numeric)
data = cell.NumericCellValue.ToString();
else if (cell.CachedFormulaResultType == CellType.String)
data = cell.StringCellValue;
else
data = cell.ToString();
}
else
{
data = cell.ToString();
}
one(rowIndex,j,data);
}
}
NPOI 读取excel表出现”-D5“
最新推荐文章于 2024-07-19 10:47:34 发布