Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
performance
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zry
performance
Commits
9093a810
Commit
9093a810
authored
Dec 30, 2020
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
读取Excel时兼容读取科学计数法的字符值
parent
08cbd670
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
12 deletions
+5
-12
performance/Performance.Infrastructure/Helper/ConvertHelper.cs
+4
-11
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadDeptAccounting.cs
+1
-1
No files found.
performance/Performance.Infrastructure/Helper/ConvertHelper.cs
View file @
9093a810
...
...
@@ -5,11 +5,10 @@
namespace
Performance.Infrastructure
{
/// <summary>
/// 类型转换
/// 类型转换
/// </summary>
public
static
class
ConvertHelper
{
public
static
int
TryInt
(
string
inValue
,
int
defaultValue
=
default
(
int
))
{
int
ret
=
defaultValue
;
...
...
@@ -27,7 +26,7 @@ public static long TryLong(string inValue, long defaultValue = default(int))
public
static
decimal
TryDecimal
(
string
inValue
,
decimal
defaultValue
=
default
(
decimal
))
{
decimal
ret
=
defaultValue
;
decimal
.
TryParse
(
inValue
,
out
ret
);
decimal
.
TryParse
(
inValue
,
System
.
Globalization
.
NumberStyles
.
Float
,
default
,
out
ret
);
return
ret
;
}
...
...
@@ -38,7 +37,6 @@ public static DateTime TryDateTime(string inValue, DateTime defaultValue = defau
return
ret
;
}
/// <summary>
/// 返回默认值
/// </summary>
...
...
@@ -70,10 +68,8 @@ public static T To<T>(object value, T defaultValue = default(T))
}
}
/// <summary>
///
///
/// </summary>
/// <typeparam name = "T"></typeparam>
/// <param name = "value">The value.</param>
...
...
@@ -95,7 +91,5 @@ public static T To<T>(object value, T defaultValue, bool ignoreException)
}
return
To
<
T
>(
value
);
}
}
}
\ No newline at end of file
}
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadDeptAccounting.cs
View file @
9093a810
...
...
@@ -41,7 +41,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{
object
@object
=
row
.
GetCell
(
point
).
GetValue
();
if
(
item
.
IsNumber
)
@object
=
ConvertHelper
.
T
o
<
decimal
?>(
@object
);
@object
=
ConvertHelper
.
T
ryDecimal
(
@object
?.
ToString
()
);
if
(
dic
.
Keys
.
Contains
(
item
.
Field
))
dic
[
item
.
Field
]
=
@object
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment