diff --git a/common.props b/common.props index 715c4f78..647b8078 100644 --- a/common.props +++ b/common.props @@ -1,6 +1,6 @@ - 2.7.4.4 + 2.7.4.100 true snupkg 1591 diff --git a/src/Magicodes.ExporterAndImporter.Excel/Utility/ImportHelper.cs b/src/Magicodes.ExporterAndImporter.Excel/Utility/ImportHelper.cs index 6d34d4ff..9193ab31 100644 --- a/src/Magicodes.ExporterAndImporter.Excel/Utility/ImportHelper.cs +++ b/src/Magicodes.ExporterAndImporter.Excel/Utility/ImportHelper.cs @@ -1095,7 +1095,7 @@ protected virtual void ParseData(ExcelPackage excelPackage) } var value = col.MappingValues[cellValue]; - + if (isEnum && isNullable && (value is int || value is short) // && Enum.IsDefined(type, value) ) @@ -1156,6 +1156,15 @@ protected virtual void ParseData(ExcelPackage excelPackage) continue; } + #region 删除千分位符 "," 及单引号 "'" + var types = new string[] { "Int64", "Nullable", "Int32", "Nullable", "Int16", "Nullable", "Decimal", "Nullable", "Double", "Nullable" }; + var csType = propertyInfo.PropertyType.GetCSharpTypeName(); + if (types.Contains(csType)) + { + cellValue = cellValue?.Replace(",", "").Replace("'", ""); + } + #endregion + switch (propertyInfo.PropertyType.GetCSharpTypeName()) { case "Boolean":