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
4483de48
Commit
4483de48
authored
Aug 17, 2022
by
Licx
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release/v22.4.18-Beta-wuzhou' into develop
parents
60a4934c
846e58a9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
22 deletions
+29
-22
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExcelHelper.cs
+26
-0
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExtractHelper.cs
+3
-21
performance/Performance.Services/ExtractExcelService/ExtractService.cs
+0
-1
No files found.
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExcelHelper.cs
View file @
4483de48
using
NPOI.HSSF.UserModel
;
using
NPOI.HSSF.UserModel
;
using
NPOI.SS.Formula
;
using
NPOI.SS.UserModel
;
using
NPOI.SS.UserModel
;
using
NPOI.XSSF.UserModel
;
using
NPOI.XSSF.UserModel
;
using
Performance.DtoModels
;
using
Performance.DtoModels
;
...
@@ -311,5 +312,30 @@ public static void EvaluateAll(this IWorkbook workbook)
...
@@ -311,5 +312,30 @@ public static void EvaluateAll(this IWorkbook workbook)
return
;
return
;
}
}
}
}
/// <summary>
/// 设置打开Excel时将更新公式
/// </summary>
/// <param name="workbook"></param>
public
static
void
ForceFormulaRecalculation
(
this
IWorkbook
workbook
)
{
try
{
if
(
workbook
==
null
)
return
;
int
index
=
0
;
while
(
index
<
workbook
.
NumberOfSheets
)
{
var
sheet
=
workbook
.
GetSheetAt
(
index
);
index
++;
sheet
.
ForceFormulaRecalculation
=
true
;
}
}
catch
{
return
;
}
}
}
}
}
}
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExtractHelper.cs
View file @
4483de48
using
NPOI.HSSF.UserModel
;
using
NPOI.SS.UserModel
;
using
NPOI.SS.Formula
;
using
NPOI.SS.UserModel
;
using
NPOI.XSSF.UserModel
;
using
OfficeOpenXml
;
using
OfficeOpenXml
;
using
Performance.DtoModels
;
using
Performance.DtoModels
;
using
Performance.EntityModels
;
using
Performance.EntityModels
;
...
@@ -10,7 +7,6 @@
...
@@ -10,7 +7,6 @@
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.IO
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
namespace
Performance.Services.ExtractExcelService
namespace
Performance.Services.ExtractExcelService
{
{
...
@@ -158,22 +154,8 @@ public static void ClearSheetPartialData(ISheet sheet, PerSheetPoint point, Shee
...
@@ -158,22 +154,8 @@ public static void ClearSheetPartialData(ISheet sheet, PerSheetPoint point, Shee
{
{
var
cell
=
row
.
GetCell
(
j
);
var
cell
=
row
.
GetCell
(
j
);
if
(
cell
==
null
)
continue
;
if
(
cell
==
null
)
continue
;
if
(
cell
.
CellType
==
CellType
.
Formula
)
if
(
cell
.
CellType
!=
CellType
.
Formula
||
sheetType
==
SheetType
.
Income
)
{
try
{
BaseFormulaEvaluator
e
=
row
.
Sheet
.
Workbook
is
XSSFWorkbook
?
new
XSSFFormulaEvaluator
(
row
.
Sheet
.
Workbook
)
:
new
HSSFFormulaEvaluator
(
row
.
Sheet
.
Workbook
);
cell
=
e
.
EvaluateInCell
(
cell
);
}
catch
{
continue
;
}
}
else
if
(
cell
.
CellType
!=
CellType
.
Formula
||
sheetType
==
SheetType
.
Income
)
{
{
cell
.
RemoveCellComment
();
cell
.
RemoveCellComment
();
row
.
RemoveCell
(
cell
);
row
.
RemoveCell
(
cell
);
...
...
performance/Performance.Services/ExtractExcelService/ExtractService.cs
View file @
4483de48
...
@@ -11,7 +11,6 @@
...
@@ -11,7 +11,6 @@
using
System.Data
;
using
System.Data
;
using
System.IO
;
using
System.IO
;
using
System.Linq
;
using
System.Linq
;
using
System.Linq.Expressions
;
namespace
Performance.Services.ExtractExcelService
namespace
Performance.Services.ExtractExcelService
{
{
...
...
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