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
9b5db502
Commit
9b5db502
authored
Oct 27, 2020
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加数据样式
parent
2eaef9e0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
performance/Performance.Services/ExtractExcelService/ExtractHelper/WriteDataHelper.cs
+11
-5
No files found.
performance/Performance.Services/ExtractExcelService/ExtractHelper/WriteDataHelper.cs
View file @
9b5db502
...
...
@@ -99,8 +99,10 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
private
static
void
WriteSheetDataExistent
(
ISheet
sheet
,
IRow
columnHeader
,
PerSheetPoint
point
,
SheetType
sheetType
,
ExcelStyle
style
,
List
<
string
>
headers
,
List
<
ExtractTransDto
>
data
,
ref
int
dataFirstRowNum
)
{
if
(
sheet
.
LastRowNum
>
dataFirstRowNum
)
{
if
(
sheet
.
LastRowNum
<=
dataFirstRowNum
)
return
;
var
cellStyle
=
style
.
SetBgkColorAndFormat
(
style
.
GetCellStyle
(),
StyleType
.
数据
);
int
dataFirstCellNum
=
point
.
DataFirstCellNum
.
Value
;
for
(
int
rowIndex
=
dataFirstRowNum
;
rowIndex
<
sheet
.
LastRowNum
+
1
;
rowIndex
++)
...
...
@@ -124,14 +126,14 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
if
(
sheetType
==
SheetType
.
Income
)
{
cell
.
SetCellOValue
(
value
);
// 添加 style
cell
.
CellStyle
=
cellStyle
;
}
else
if
(
cell
.
CellType
!=
CellType
.
Formula
)
{
cell
.
SetCellOValue
(
value
);
if
(
headers
!=
null
&&
headers
.
Contains
(
column
))
{
// 是新增项,且该抽取数据在新增项中 添加style
cell
.
CellStyle
=
cellStyle
;
}
}
}
...
...
@@ -140,7 +142,6 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
if
(
rowIndex
>
dataFirstRowNum
)
dataFirstRowNum
=
rowIndex
+
1
;
}
}
}
private
static
void
WriteSheetDataNonexistent
(
ISheet
sheet
,
IRow
columnHeader
,
PerSheetPoint
point
,
SheetType
sheetType
,
ExcelStyle
style
,
List
<
string
>
headers
,
List
<
ExtractTransDto
>
data
,
int
dataFirstRowNum
)
...
...
@@ -153,6 +154,9 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
filed
=
sheet
.
SheetName
.
Contains
(
"医生"
)
?
fieldDoctor
:
fieldNurse
;
}
var
deptStyle
=
style
.
GetCellStyle
();
var
cellStyle
=
style
.
SetBgkColorAndFormat
(
style
.
GetCellStyle
(),
StyleType
.
数据
);
foreach
(
string
department
in
departments
)
{
var
deptData
=
data
.
Where
(
t
=>
t
.
Department
==
department
);
...
...
@@ -167,11 +171,13 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
if
(
filed
.
ContainsKey
(
column
))
{
cell
.
SetCellOValue
(
filed
[
column
]?.
Invoke
(
deptData
.
First
()));
cell
.
CellStyle
=
deptStyle
;
}
else
if
(
sheetType
==
SheetType
.
Income
||
(
headers
!=
null
&&
headers
.
Contains
(
column
)))
{
var
value
=
deptData
.
FirstOrDefault
(
t
=>
t
.
Category
==
column
)?.
Value
;
cell
.
SetCellOValue
(
value
);
cell
.
CellStyle
=
cellStyle
;
}
}
dataFirstRowNum
++;
...
...
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