Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
37ff11f4
Commit
37ff11f4
authored
Jan 13, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change function _pasteFromHTML
parent
15accf65
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
78 deletions
+83
-78
cell/view/WorksheetView.js
cell/view/WorksheetView.js
+83
-78
No files found.
cell/view/WorksheetView.js
View file @
37ff11f4
...
...
@@ -8938,7 +8938,7 @@
//проверка на наличие части объединённой ячейки в области куда осуществляем вставку
for
(
var
rFirst
=
arn
.
r1
;
rFirst
<
rMax
;
++
rFirst
)
{
for
(
var
cFirst
=
arn
.
c1
;
cFirst
<
cMax
;
++
cFirst
)
{
range
=
t
.
model
.
getRange3
(
rFirst
,
cFirst
,
rFirst
,
cFirst
);
var
range
=
t
.
model
.
getRange3
(
rFirst
,
cFirst
,
rFirst
,
cFirst
);
var
merged
=
range
.
hasMerged
();
if
(
merged
)
{
if
(
merged
.
r1
<
arn
.
r1
||
merged
.
r2
>
rMax
-
1
||
merged
.
c1
<
arn
.
c1
||
merged
.
c2
>
cMax
-
1
)
{
...
...
@@ -9054,91 +9054,96 @@
newHyperlink
.
Ref
=
range
;
newHyperlink
.
Tooltip
=
props
.
hyperLink
;
range
.
setHyperlink
(
newHyperlink
);
}
};
}
};
var
mergeArr
=
[];
var
putInsertedCellIntoRange
=
function
(
row
,
col
,
currentObj
)
{
var
pastedRangeProps
=
{};
var
contentCurrentObj
=
currentObj
.
content
;
var
range
=
t
.
model
.
getRange3
(
row
,
col
,
row
,
col
);
//value
if
(
contentCurrentObj
.
length
===
1
)
{
var
onlyOneChild
=
contentCurrentObj
[
0
];
var
valFormat
=
onlyOneChild
.
text
;
pastedRangeProps
.
val
=
valFormat
;
pastedRangeProps
.
font
=
onlyOneChild
.
format
;
}
else
{
pastedRangeProps
.
value2
=
contentCurrentObj
;
pastedRangeProps
.
alignVertical
=
currentObj
.
va
;
}
if
(
contentCurrentObj
.
length
===
1
&&
contentCurrentObj
[
0
].
format
)
{
var
fs
=
contentCurrentObj
[
0
].
format
.
getSize
();
if
(
fs
!==
''
&&
fs
!==
null
&&
fs
!==
undefined
)
{
pastedRangeProps
.
fontSize
=
fs
;
}
}
//AlignHorizontal
if
(
!
isOneMerge
)
{
pastedRangeProps
.
alignHorizontal
=
currentObj
.
a
;
}
//for merge
var
isMerged
=
false
;
for
(
var
mergeCheck
=
0
;
mergeCheck
<
mergeArr
.
length
;
++
mergeCheck
)
{
var
tempRow
=
row
+
1
;
var
tempCol
=
col
+
1
;
if
(
tempRow
<=
mergeArr
[
mergeCheck
].
r2
&&
tempRow
>=
mergeArr
[
mergeCheck
].
r1
&&
tempCol
<=
mergeArr
[
mergeCheck
].
c2
&&
tempCol
>=
mergeArr
[
mergeCheck
].
c1
)
{
isMerged
=
true
;
}
}
if
((
currentObj
.
colSpan
>
1
||
currentObj
.
rowSpan
>
1
)
&&
!
isMerged
)
{
var
offsetCol
=
currentObj
.
colSpan
-
1
;
var
offsetRow
=
currentObj
.
rowSpan
-
1
;
pastedRangeProps
.
offsetLast
=
{
offsetCol
:
offsetCol
,
offsetRow
:
offsetRow
};
mergeArr
[
n
]
=
{
r1
:
range
.
first
.
row
,
r2
:
range
.
last
.
row
+
offsetRow
,
c1
:
range
.
first
.
col
,
c2
:
range
.
last
.
col
+
offsetCol
};
n
++
;
if
(
contentCurrentObj
[
0
]
==
undefined
)
{
pastedRangeProps
.
val
=
''
;
}
pastedRangeProps
.
merge
=
c_oAscMergeOptions
.
Merge
;
}
//borders
if
(
!
isOneMerge
)
{
pastedRangeProps
.
borders
=
currentObj
.
borders
;
}
//wrap
pastedRangeProps
.
wrap
=
currentObj
.
wrap
;
//fill
if
(
currentObj
.
bc
&&
currentObj
.
bc
.
rgb
)
{
pastedRangeProps
.
fill
=
currentObj
.
bc
;
}
//hyperlink
var
link
=
currentObj
.
hyperLink
;
if
(
link
)
{
pastedRangeProps
.
hyperLink
=
currentObj
;
}
//apply props by cell
applyPropertiesByRange
(
range
,
pastedRangeProps
);
};
var
mergeArr
=
[];
for
(
var
autoR
=
0
;
autoR
<
maxARow
;
++
autoR
)
{
for
(
var
autoC
=
0
;
autoC
<
maxACol
;
++
autoC
)
{
for
(
var
r
=
0
;
r
<
rMax
;
++
r
)
{
for
(
var
c
=
0
;
c
<
pasteContent
.
content
[
r
].
length
;
++
c
)
{
if
(
undefined
!==
pasteContent
.
content
[
r
][
c
])
{
var
pasteIntoRow
=
r
+
autoR
*
plRow
+
arn
.
r1
;
if
(
undefined
!==
pasteContent
.
content
[
r
][
c
])
{
var
pasteIntoRow
=
r
+
autoR
*
plRow
+
arn
.
r1
;
var
pasteIntoCol
=
c
+
autoC
*
plCol
+
arn
.
c1
;
var
range
=
t
.
model
.
getRange3
(
pasteIntoRow
,
pasteIntoCol
,
pasteIntoRow
,
pasteIntoCol
);
var
pastedRangeProps
=
{};
var
currentObj
=
pasteContent
.
content
[
r
][
c
];
var
contentCurrentObj
=
currentObj
.
content
;
//value
if
(
contentCurrentObj
.
length
===
1
)
{
var
onlyOneChild
=
contentCurrentObj
[
0
];
var
valFormat
=
onlyOneChild
.
text
;
pastedRangeProps
.
val
=
valFormat
;
pastedRangeProps
.
font
=
onlyOneChild
.
format
;
}
else
{
pastedRangeProps
.
value2
=
contentCurrentObj
;
pastedRangeProps
.
alignVertical
=
currentObj
.
va
;
}
if
(
contentCurrentObj
.
length
===
1
&&
contentCurrentObj
[
0
].
format
)
{
var
fs
=
contentCurrentObj
[
0
].
format
.
getSize
();
if
(
fs
!==
''
&&
fs
!==
null
&&
fs
!==
undefined
)
{
pastedRangeProps
.
fontSize
=
fs
;
}
}
//AlignHorizontal
if
(
!
isOneMerge
)
{
pastedRangeProps
.
alignHorizontal
=
currentObj
.
a
;
}
//for merge
var
isMerged
=
false
;
for
(
var
mergeCheck
=
0
;
mergeCheck
<
mergeArr
.
length
;
++
mergeCheck
)
{
var
tempRow
=
pasteIntoRow
+
1
;
var
tempCol
=
pasteIntoCol
+
1
;
if
(
tempRow
<=
mergeArr
[
mergeCheck
].
r2
&&
tempRow
>=
mergeArr
[
mergeCheck
].
r1
&&
tempCol
<=
mergeArr
[
mergeCheck
].
c2
&&
tempCol
>=
mergeArr
[
mergeCheck
].
c1
)
{
isMerged
=
true
;
}
}
if
((
currentObj
.
colSpan
>
1
||
currentObj
.
rowSpan
>
1
)
&&
!
isMerged
)
{
var
offsetCol
=
currentObj
.
colSpan
-
1
;
var
offsetRow
=
currentObj
.
rowSpan
-
1
;
pastedRangeProps
.
offsetLast
=
{
offsetCol
:
offsetCol
,
offsetRow
:
offsetRow
};
mergeArr
[
n
]
=
{
r1
:
range
.
first
.
row
,
r2
:
range
.
last
.
row
+
offsetRow
,
c1
:
range
.
first
.
col
,
c2
:
range
.
last
.
col
+
offsetCol
};
n
++
;
if
(
contentCurrentObj
[
0
]
==
undefined
)
{
pastedRangeProps
.
val
=
''
;
}
pastedRangeProps
.
merge
=
c_oAscMergeOptions
.
Merge
;
}
//borders
if
(
!
isOneMerge
)
{
pastedRangeProps
.
borders
=
currentObj
.
borders
;
}
//wrap
pastedRangeProps
.
wrap
=
currentObj
.
wrap
;
//fill
if
(
currentObj
.
bc
&&
currentObj
.
bc
.
rgb
)
{
pastedRangeProps
.
fill
=
currentObj
.
bc
;
}
//hyperlink
var
link
=
pasteContent
.
content
[
r
][
c
].
hyperLink
;
if
(
link
)
{
pastedRangeProps
.
hyperLink
=
pasteContent
.
content
[
r
][
c
];
}
//apply props by cell
applyPropertiesByRange
(
range
,
pastedRangeProps
);
putInsertedCellIntoRange
(
pasteIntoRow
,
pasteIntoCol
,
currentObj
);
}
}
}
...
...
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