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
fef2bbad
Commit
fef2bbad
authored
Jan 04, 2024
by
何远江
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改纵向标题bug
parent
b6e296d7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
9 deletions
+2
-9
excel.ts
src/utils/excel.ts
+2
-9
No files found.
src/utils/excel.ts
View file @
fef2bbad
...
@@ -57,17 +57,13 @@ export function handleRangeTitle(range: any, dataArea: Recordable) {
...
@@ -57,17 +57,13 @@ 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
}
else
if
(
rowLen
-
1
===
endRow
-
beginRow
&&
columnLen
-
1
!==
endColum
-
beginColum
)
{
}
else
if
(
rowLen
-
1
===
endRow
-
beginRow
&&
(
columnLen
-
1
!==
endColum
-
beginColum
||
columnLen
==
1
)
)
{
isVertical
=
true
isVertical
=
true
}
}
console
.
log
(
'isVertical'
,
isVertical
,
rowLen
,
columnLen
,
dataArea
)
/**
/**
* 取最后一个单元格的坐标,值为最后一个单元格,如果当前单元格没有值,继承前一个单元格值
* 取最后一个单元格的坐标,值为最后一个单元格,如果当前单元格没有值,继承前一个单元格值
*
*
...
@@ -84,7 +80,6 @@ export function handleRangeTitle(range: any, dataArea: Recordable) {
...
@@ -84,7 +80,6 @@ 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
{
...
@@ -96,13 +91,11 @@ export function handleRangeTitle(range: any, dataArea: Recordable) {
...
@@ -96,13 +91,11 @@ export function handleRangeTitle(range: any, dataArea: Recordable) {
if
(
cell
?.
mc
)
{
if
(
cell
?.
mc
)
{
r
+=
isVertical
?
cell
.
mc
.
cs
-
1
:
cell
.
mc
.
rs
-
1
r
+=
isVertical
?
cell
.
mc
.
cs
-
1
:
cell
.
mc
.
rs
-
1
c
+=
isVertical
?
cell
.
mc
.
rs
-
1
:
cell
.
mc
.
cs
-
1
c
+=
isVertical
?
cell
.
mc
.
rs
-
1
:
cell
.
mc
.
cs
-
1
}
}
title
.
title
=
v
.
replaceAll
(
' '
,
''
)
title
.
title
=
v
.
replaceAll
(
/
(\s
+
)
/g
,
''
)
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