Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

数值类型自动去掉千分位 #510

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>2.7.4.4</Version>
<Version>2.7.4.100</Version>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<NoWarn>1591</NoWarn>
Expand Down
11 changes: 10 additions & 1 deletion src/Magicodes.ExporterAndImporter.Excel/Utility/ImportHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
Expand Down Expand Up @@ -1156,6 +1156,15 @@ protected virtual void ParseData(ExcelPackage excelPackage)
continue;
}

#region 删除千分位符 ","
var types = new string[] { "Int64", "Nullable<Int64>", "Int32", "Nullable<Int32>", "Int16", "Nullable<Int16>", "Decimal", "Nullable<Decimal>", "Double", "Nullable<Double>" };
var csType = propertyInfo.PropertyType.GetCSharpTypeName();
if (types.Contains(csType))
{
cellValue = cellValue?.Replace(",", "");
}
#endregion

switch (propertyInfo.PropertyType.GetCSharpTypeName())
{
case "Boolean":
Expand Down