Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
topsun-baoshen-excel
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
何远江
topsun-baoshen-excel
Commits
b6e296d7
Commit
b6e296d7
authored
Jan 04, 2024
by
何远江
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug 修改
parent
4a5cc487
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
excel.ts
src/utils/excel.ts
+7
-2
No files found.
src/utils/excel.ts
View file @
b6e296d7
...
@@ -57,6 +57,8 @@ export function handleRangeTitle(range: any, dataArea: Recordable) {
...
@@ -57,6 +57,8 @@ export function handleRangeTitle(range: any, dataArea: Recordable) {
const
titles
:
Recordable
[]
=
[]
const
titles
:
Recordable
[]
=
[]
let
isVertical
=
false
let
isVertical
=
false
console
.
log
(
'handleRangeTitle'
,
range
,
dataArea
)
// 只有一行,只能横向
// 只有一行,只能横向
if
(
rowLen
==
1
)
{
if
(
rowLen
==
1
)
{
isVertical
=
false
isVertical
=
false
...
@@ -82,6 +84,7 @@ export function handleRangeTitle(range: any, dataArea: Recordable) {
...
@@ -82,6 +84,7 @@ export function handleRangeTitle(range: any, dataArea: Recordable) {
}
}
for
(
let
r
=
0
;
r
<
(
isVertical
?
columnLen
:
rowLen
);
r
++
)
{
for
(
let
r
=
0
;
r
<
(
isVertical
?
columnLen
:
rowLen
);
r
++
)
{
const
cell
=
isVertical
?
range
[
c
][
r
]
:
range
[
r
][
c
]
const
cell
=
isVertical
?
range
[
c
][
r
]
:
range
[
r
][
c
]
console
.
log
(
'cell'
,
cell
,
r
,
c
)
let
v
=
''
let
v
=
''
// 如果获取值报错,那么断定单元格值为空,直接取上一个单元格的值
// 如果获取值报错,那么断定单元格值为空,直接取上一个单元格的值
try
{
try
{
...
@@ -91,13 +94,15 @@ export function handleRangeTitle(range: any, dataArea: Recordable) {
...
@@ -91,13 +94,15 @@ export function handleRangeTitle(range: any, dataArea: Recordable) {
}
}
// 如果有单元格合并,跳过单元格
// 如果有单元格合并,跳过单元格
if
(
cell
?.
mc
)
{
if
(
cell
?.
mc
)
{
r
+=
isVertical
?
cell
.
mc
.
rs
-
1
:
cell
.
mc
.
cs
-
1
r
+=
isVertical
?
cell
.
mc
.
cs
-
1
:
cell
.
mc
.
rs
-
1
c
+=
isVertical
?
cell
.
mc
.
cs
-
1
:
cell
.
mc
.
rs
-
1
c
+=
isVertical
?
cell
.
mc
.
rs
-
1
:
cell
.
mc
.
cs
-
1
}
}
title
.
title
=
v
.
replaceAll
(
' '
,
''
)
title
.
title
=
v
.
replaceAll
(
' '
,
''
)
title
.
colum
=
+
beginColum
+
(
isVertical
?
r
:
c
)
title
.
colum
=
+
beginColum
+
(
isVertical
?
r
:
c
)
title
.
row
=
+
beginRow
+
(
isVertical
?
c
:
r
)
title
.
row
=
+
beginRow
+
(
isVertical
?
c
:
r
)
}
}
console
.
log
(
'title'
,
title
)
titles
.
push
(
title
)
titles
.
push
(
title
)
}
}
...
...
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