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
0e65fa7a
Commit
0e65fa7a
authored
Jan 13, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change function _pasteFromHTML
parent
1fcb92cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
61 deletions
+27
-61
cell/model/clipboard.js
cell/model/clipboard.js
+17
-19
cell/view/WorksheetView.js
cell/view/WorksheetView.js
+10
-42
No files found.
cell/model/clipboard.js
View file @
0e65fa7a
...
...
@@ -1737,7 +1737,7 @@
_insertImagesFromBinaryWord
:
function
(
ws
,
data
,
aImagesSync
)
{
var
activeRange
=
ws
.
activeRange
;
var
activeRange
=
ws
.
model
.
selectionRange
.
getLast
().
clone
()
;
var
curCol
,
drawingObject
,
curRow
,
startCol
=
0
,
startRow
=
0
,
xfrm
,
drawingBase
,
graphicObject
,
offX
,
offY
,
rot
;
History
.
Create_NewPoint
();
...
...
@@ -1839,8 +1839,8 @@
AscFormat
.
CheckSpPrXfrm
(
drawingObject
.
graphicObject
);
xfrm
=
drawingObject
.
graphicObject
.
spPr
.
xfrm
;
curCol
=
xfrm
.
offX
-
startCol
+
ws
.
objectRender
.
convertMetric
(
ws
.
cols
[
addImagesFromWord
[
i
].
col
].
left
-
ws
.
getCellLeft
(
0
,
1
),
1
,
3
);
curRow
=
xfrm
.
offY
-
startRow
+
ws
.
objectRender
.
convertMetric
(
ws
.
rows
[
addImagesFromWord
[
i
].
row
].
top
-
ws
.
getCellTop
(
0
,
1
),
1
,
3
);
curCol
=
xfrm
.
offX
-
startCol
+
ws
.
objectRender
.
convertMetric
(
ws
.
cols
[
addImagesFromWord
[
i
].
col
+
activeRange
.
c1
].
left
-
ws
.
getCellLeft
(
0
,
1
),
1
,
3
);
curRow
=
xfrm
.
offY
-
startRow
+
ws
.
objectRender
.
convertMetric
(
ws
.
rows
[
addImagesFromWord
[
i
].
row
+
activeRange
.
r1
].
top
-
ws
.
getCellTop
(
0
,
1
),
1
,
3
);
xfrm
.
setOffX
(
curCol
);
xfrm
.
setOffY
(
curRow
);
...
...
@@ -2404,7 +2404,6 @@
_getTableFromText
:
function
(
worksheet
,
sText
)
{
var
activeRange
=
worksheet
.
model
.
selectionRange
.
getLast
().
clone
(
true
);
var
t
=
this
;
var
addTextIntoCell
=
function
(
row
,
col
,
text
)
...
...
@@ -2417,8 +2416,8 @@
var
aResult
=
new
excelPasteContent
();
var
width
=
0
;
var
colCounter
=
activeRange
.
c1
;
var
rowCounter
=
activeRange
.
r1
;
var
colCounter
=
0
;
var
rowCounter
=
0
;
var
sCurChar
=
""
;
for
(
var
i
=
0
,
length
=
sText
.
length
;
i
<
length
;
i
++
)
{
...
...
@@ -2426,9 +2425,9 @@
var
Code
=
sText
.
charCodeAt
(
i
);
var
Item
=
null
;
if
(
colCounter
-
activeRange
.
c1
>
width
)
if
(
colCounter
>
width
)
{
width
=
colCounter
-
activeRange
.
c1
;
width
=
colCounter
;
}
if
(
'
\n
'
===
Char
)
...
...
@@ -2436,13 +2435,13 @@
if
(
""
==
sCurChar
)
{
addTextIntoCell
(
rowCounter
,
colCounter
,
sCurChar
);
colCounter
=
activeRange
.
c1
;
colCounter
=
0
;
rowCounter
++
;
}
else
{
addTextIntoCell
(
rowCounter
,
colCounter
,
sCurChar
);
colCounter
=
activeRange
.
c1
;
colCounter
=
0
;
rowCounter
++
;
sCurChar
=
""
;
...
...
@@ -2608,7 +2607,6 @@
_paste
:
function
(
worksheet
,
pasteData
)
{
var
documentContent
=
pasteData
.
content
;
var
activeRange
=
worksheet
.
model
.
selectionRange
.
getLast
().
clone
();
if
(
pasteData
.
images
&&
pasteData
.
images
.
length
)
this
.
isUsuallyPutImages
=
true
;
...
...
@@ -2617,7 +2615,7 @@
var
documentContentBounds
=
new
DocumentContentBounds
();
var
coverDocument
=
documentContentBounds
.
getBounds
(
0
,
0
,
documentContent
);
this
.
_parseChildren
(
coverDocument
,
activeRange
);
this
.
_parseChildren
(
coverDocument
);
this
.
aResult
.
props
.
fontsNew
=
this
.
fontsNew
;
...
...
@@ -2629,7 +2627,7 @@
worksheet
.
setSelectionInfo
(
'
paste
'
,
this
.
aResult
,
this
);
},
_parseChildren
:
function
(
children
,
activeRange
)
_parseChildren
:
function
(
children
)
{
var
childrens
=
children
.
children
;
for
(
var
i
=
0
;
i
<
childrens
.
length
;
i
++
)
...
...
@@ -2661,7 +2659,7 @@
}
var
newCell
=
this
.
aResult
.
getCell
(
row
+
activeRange
.
r1
,
col
+
activeRange
.
c1
)
var
newCell
=
this
.
aResult
.
getCell
(
row
,
col
)
newCell
.
rowSpan
=
rowSpan
;
newCell
.
colSpan
=
colSpan
;
...
...
@@ -2684,14 +2682,14 @@
var
colSpan
=
null
;
var
rowSpan
=
null
;
this
.
_parseParagraph
(
childrens
[
i
],
activeRange
,
childrens
[
i
].
top
+
activeRange
.
r1
,
childrens
[
i
].
left
+
activeRange
.
c1
);
this
.
_parseParagraph
(
childrens
[
i
],
childrens
[
i
].
top
,
childrens
[
i
].
left
);
}
else
this
.
_parseChildren
(
childrens
[
i
]
,
activeRange
);
this
.
_parseChildren
(
childrens
[
i
]);
}
},
_parseParagraph
:
function
(
paragraph
,
activeRange
,
row
,
col
,
rowSpan
,
colSpan
)
_parseParagraph
:
function
(
paragraph
,
row
,
col
,
rowSpan
,
colSpan
)
{
var
content
=
paragraph
.
elem
.
Content
;
var
row
,
cTextPr
,
fontFamily
=
"
Arial
"
;
...
...
@@ -2704,7 +2702,7 @@
{
if
(
aResult
.
content
.
length
==
0
)
{
row
=
activeRange
.
r1
;
row
=
0
;
}
else
row
=
aResult
.
length
;
...
...
@@ -2727,7 +2725,7 @@
};
var
s
=
0
;
var
c1
=
col
!==
undefined
?
col
:
activeRange
.
c1
;
var
c1
=
col
!==
undefined
?
col
:
0
;
//backgroundColor
var
backgroundColor
=
this
.
getBackgroundColorTCell
(
paragraph
);
...
...
cell/view/WorksheetView.js
View file @
0e65fa7a
...
...
@@ -8916,11 +8916,7 @@
var
arrFormula
=
[];
var
numFor
=
0
;
var
rMax
=
pasteContent
.
content
.
length
+
pasteContent
.
props
.
rowSpanSpCount
;
if
(
pasteContent
.
props
.
rowCount
&&
pasteContent
.
props
.
rowCount
!==
0
&&
pasteContent
.
props
.
isOneTable
)
{
rMax
=
pasteContent
.
props
.
rowCount
+
arn
.
r1
;
}
var
rMax
=
pasteContent
.
content
.
length
+
pasteContent
.
props
.
rowSpanSpCount
+
arn
.
r1
;
var
cMax
=
pasteContent
.
props
.
cellCount
+
arn
.
c1
;
var
isMultiple
=
false
;
...
...
@@ -8933,32 +8929,14 @@
//если вставляем в мерженную ячейку, диапазон которой больше или равен
if
(
arn
.
c2
>=
cMax
-
1
&&
arn
.
r2
>=
rMax
-
1
&&
isMergedFirstCell
&&
isMergedFirstCell
.
c1
===
arn
.
c1
&&
isMergedFirstCell
.
c2
===
arn
.
c2
&&
isMergedFirstCell
.
r1
===
arn
.
r1
&&
isMergedFirstCell
.
r2
===
arn
.
r2
&&
cMax
-
arn
.
c1
===
pasteContent
.
content
[
arn
.
r1
][
arn
.
c1
].
colSpan
&&
rMax
-
arn
.
r1
===
pasteContent
.
content
[
arn
.
r1
][
arn
.
c1
].
rowSpan
)
{
cMax
-
arn
.
c1
===
pasteContent
.
content
[
0
][
0
].
colSpan
&&
rMax
-
arn
.
r1
===
pasteContent
.
content
[
0
][
0
].
rowSpan
)
{
if
(
!
isCheckSelection
)
{
pasteContent
.
content
[
arn
.
r1
][
arn
.
c1
].
colSpan
=
isMergedFirstCell
.
c2
-
isMergedFirstCell
.
c1
+
1
;
pasteContent
.
content
[
arn
.
r1
][
arn
.
c1
].
rowSpan
=
isMergedFirstCell
.
r2
-
isMergedFirstCell
.
r1
+
1
;
pasteContent
.
content
[
0
][
0
].
colSpan
=
isMergedFirstCell
.
c2
-
isMergedFirstCell
.
c1
+
1
;
pasteContent
.
content
[
0
][
0
].
rowSpan
=
isMergedFirstCell
.
r2
-
isMergedFirstCell
.
r1
+
1
;
}
isOneMerge
=
true
;
}
else
if
(
arn
.
c2
>=
cMax
-
1
&&
arn
.
r2
>=
rMax
-
1
&&
pasteContent
.
props
.
isOneTable
)
{
//если область кратная куску вставки
var
widthArea
=
arn
.
c2
-
arn
.
c1
+
1
;
var
heightArea
=
arn
.
r2
-
arn
.
r1
+
1
;
var
widthPasteFr
=
cMax
-
arn
.
c1
;
var
heightPasteFr
=
rMax
-
arn
.
r1
;
//если кратны, то обрабатываем
if
(
widthArea
%
widthPasteFr
===
0
&&
heightArea
%
heightPasteFr
===
0
)
{
isMultiple
=
true
;
}
else
if
(
firstCell
.
hasMerged
()
!==
null
)
//в противном случае ошибка
{
if
(
isCheckSelection
)
{
return
arn
;
}
else
{
this
.
handlers
.
trigger
(
"
onError
"
,
c_oAscError
.
ID
.
PastInMergeAreaError
,
c_oAscError
.
Level
.
NoCritical
);
return
;
}
}
}
else
{
}
else
{
//проверка на наличие части объединённой ячейки в области куда осуществляем вставку
for
(
var
rFirst
=
arn
.
r1
;
rFirst
<
rMax
;
++
rFirst
)
{
for
(
var
cFirst
=
arn
.
c1
;
cFirst
<
cMax
;
++
cFirst
)
{
...
...
@@ -9017,24 +8995,14 @@
var
plCol
=
0
;
}
if
(
isMultiple
)
{
if
(
pasteContent
.
content
[
arn
.
r1
]
&&
pasteContent
.
content
[
arn
.
r1
][
arn
.
c1
])
{
var
currentObj
=
pasteContent
.
content
[
arn
.
r1
][
arn
.
c1
].
content
[
0
];
var
valFormat
=
''
;
if
(
currentObj
[
0
]
!==
undefined
)
{
valFormat
=
currentObj
[
0
].
text
;
}
}
}
var
mergeArr
=
[];
for
(
var
autoR
=
0
;
autoR
<
maxARow
;
++
autoR
)
{
for
(
var
autoC
=
0
;
autoC
<
maxACol
;
++
autoC
)
{
for
(
var
r
=
arn
.
r1
;
r
<
rMax
;
++
r
)
{
for
(
var
c
=
arn
.
c1
;
c
<
pasteContent
.
content
[
r
].
length
;
++
c
)
{
for
(
var
r
=
0
;
r
<
rMax
;
++
r
)
{
for
(
var
c
=
0
;
c
<
pasteContent
.
content
[
r
].
length
;
++
c
)
{
if
(
undefined
!==
pasteContent
.
content
[
r
][
c
])
{
var
range
=
t
.
model
.
getRange3
(
r
+
autoR
*
plRow
,
c
+
autoC
*
plCol
,
r
+
autoR
*
plRow
,
c
+
autoC
*
plCol
);
var
range
=
t
.
model
.
getRange3
(
r
+
autoR
*
plRow
+
arn
.
r1
,
c
+
autoC
*
plCol
+
arn
.
c1
,
r
+
autoR
*
plRow
+
arn
.
r1
,
c
+
autoC
*
plCol
+
arn
.
c1
);
var
currentObj
=
pasteContent
.
content
[
r
][
c
];
var
contentCurrentObj
=
currentObj
.
content
;
...
...
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