【发布时间】:2019-08-01 17:54:59
【问题描述】:
我有一个 Excel 文档,我尝试将其导入我的系统。 (.net core 2.2 和 EPPlus v4.5.3.1)
09:57:32等excel数据和自定义单元格格式[hh]:mm:ss
private TimeSpan? GetRequiredTimeFromRowOrNull(ExcelWorksheet worksheet, int row, int column, string columnName, StringBuilder exceptionMessage)
{
worksheet.Cells[row, column].Style.Numberformat.Format = "hh:mm:ss";
var cellValue = TimeSpan.Parse(worksheet.Cells[row, column].Value.ToString());
if (cellValue.ToString() != null && !string.IsNullOrWhiteSpace(cellValue.ToString()))
{
return cellValue;
}
exceptionMessage.Append(GetLocalizedExceptionMessagePart(columnName));
return null;
}
"worksheet.Cells[行, 列].Value" 来0.414953703703704
还有
“worksheet.Cells[row, column].Text” 09:12:32 出现
我怎样才能得到准确的值?
【问题讨论】:
标签: c# excel asp.net-core import epplus