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
34945127
Commit
34945127
authored
Jan 16, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add function _setPastedDataByCurrentRange
parent
792398ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
172 additions
and
245 deletions
+172
-245
cell/view/WorksheetView.js
cell/view/WorksheetView.js
+172
-245
No files found.
cell/view/WorksheetView.js
View file @
34945127
...
...
@@ -8992,74 +8992,6 @@
var
plRow
=
0
;
var
plCol
=
0
;
}
var
applyPropertiesByRange
=
function
(
range
,
props
)
{
if
(
props
.
val
)
{
range
.
setValue
(
props
.
val
);
}
if
(
props
.
numFormat
)
{
range
.
setNumFormat
(
props
.
numFormat
);
}
if
(
props
.
font
)
{
range
.
setFont
(
props
.
font
);
}
if
(
props
.
value2
)
{
range
.
setValue2
(
props
.
value2
);
}
if
(
props
.
alignVertical
)
{
range
.
setAlignVertical
(
props
.
alignVertical
);
}
if
(
props
.
alignHorizontal
)
{
range
.
setAlignHorizontal
(
props
.
alignHorizontal
);
}
if
(
props
.
fontSize
)
{
range
.
setFontsize
(
props
.
fontSize
);
}
if
(
props
.
offsetLast
)
{
range
.
setOffsetLast
(
props
.
offsetLast
);
}
if
(
props
.
merge
)
{
range
.
merge
(
props
.
merge
);
}
if
(
props
.
borders
)
{
range
.
setBorderSrc
(
props
.
borders
);
}
if
(
props
.
wrap
)
{
range
.
setWrap
(
props
.
wrap
);
}
if
(
props
.
fill
)
{
range
.
setFill
(
props
.
fill
);
}
if
(
props
.
hyperLink
)
{
var
_link
=
props
.
hyperLink
.
hyperLink
;
var
newHyperlink
=
new
AscCommonExcel
.
Hyperlink
();
if
(
_link
.
search
(
'
#
'
)
===
0
)
{
newHyperlink
.
setLocation
(
_link
.
replace
(
'
#
'
,
''
));
}
else
{
newHyperlink
.
Hyperlink
=
_link
;
}
newHyperlink
.
Ref
=
range
;
newHyperlink
.
Tooltip
=
props
.
hyperLink
;
range
.
setHyperlink
(
newHyperlink
);
}
};
var
mergeArr
=
[];
var
putInsertedCellIntoRange
=
function
(
row
,
col
,
currentObj
)
...
...
@@ -9134,7 +9066,7 @@
}
//apply props by cell
applyPropertiesBy
Range
(
range
,
pastedRangeProps
);
t
.
_setPastedDataByCurrent
Range
(
range
,
pastedRangeProps
);
};
for
(
var
autoR
=
0
;
autoR
<
maxARow
;
++
autoR
)
{
...
...
@@ -9172,7 +9104,6 @@
var
t
=
this
;
var
arn
=
t
.
model
.
selectionRange
.
getLast
();
var
arrFormula
=
[];
var
numFor
=
0
;
var
pasteRange
=
window
[
"
Asc
"
][
"
editor
"
].
wb
.
clipboard
.
pasteProcessor
.
activeRange
;
var
activeCellsPasteFragment
=
AscCommonExcel
.
g_oRangeCache
.
getAscRange
(
pasteRange
);
...
...
@@ -9364,175 +9295,12 @@
}
};
var
setFormula
=
function
(
newVal
,
range
)
var
putInsertedCellIntoRange
=
function
(
nRow
,
nCol
,
pasteRow
,
pasteCol
,
rowDiff
,
colDiff
,
range
,
newVal
)
{
var
pastedRangeProps
=
{};
//range может далее изменится в связи с наличием мерженных ячеек, firstRange - не меняется(ему делаем setValue, как первой ячейке в диапазоне мерженных)
var
firstRange
=
range
.
clone
();
var
numFormula
=
null
;
var
skipFormat
=
null
;
var
noSkipVal
=
null
;
var
value2
=
newVal
.
getValue2
();
for
(
var
nF
=
0
;
nF
<
value2
.
length
;
nF
++
)
{
if
(
value2
[
nF
]
&&
value2
[
nF
].
sId
)
{
numFormula
=
nF
;
break
;
}
else
if
(
value2
[
nF
]
&&
value2
[
nF
].
format
&&
value2
[
nF
].
format
.
getSkip
())
{
skipFormat
=
true
;
}
else
if
(
value2
[
nF
]
&&
value2
[
nF
].
format
&&
!
value2
[
nF
].
format
.
getSkip
())
{
noSkipVal
=
nF
;
}
}
//TODO вместо range где возможно использовать cell
var
cellFrom
,
cellTo
;
if
(
value2
.
length
==
1
||
numFormula
!=
null
||
(
skipFormat
!=
null
&&
noSkipVal
!=
null
))
{
if
(
numFormula
==
null
)
{
numFormula
=
0
;
}
var
numStyle
=
0
;
if
(
skipFormat
!=
null
&&
noSkipVal
!=
null
)
{
numStyle
=
noSkipVal
;
}
//formula
if
(
newVal
.
getFormula
()
&&
!
isOneMerge
)
{
var
offset
=
range
.
getCells
()[
numFormula
].
getOffset2
(
value2
[
numFormula
].
sId
),
assemb
,
_p_
=
new
AscCommonExcel
.
parserFormula
(
value2
[
numFormula
].
sFormula
,
null
,
range
.
worksheet
);
if
(
_p_
.
parse
())
{
if
(
null
!==
tablesMap
)
{
var
renameParams
=
{};
renameParams
.
offset
=
offset
;
renameParams
.
tableNameMap
=
tablesMap
;
_p_
.
renameSheetCopy
(
renameParams
);
assemb
=
_p_
.
assemble
(
true
)
}
else
{
assemb
=
_p_
.
changeOffset
(
offset
).
assemble
(
true
);
}
arrFormula
[
numFor
]
=
{};
arrFormula
[
numFor
].
range
=
range
;
arrFormula
[
numFor
].
val
=
"
=
"
+
assemb
;
numFor
++
;
}
}
else
{
cellFrom
=
newVal
.
getCells
();
if
(
isOneMerge
&&
range
&&
range
.
bbox
)
{
cellTo
=
this
.
_getCell
(
range
.
bbox
.
c1
,
range
.
bbox
.
r1
).
getCells
();
}
else
{
cellTo
=
firstRange
.
getCells
();
}
if
(
cellFrom
&&
cellTo
&&
cellFrom
[
0
]
&&
cellTo
[
0
])
{
cellTo
[
0
].
setValueData
(
cellFrom
[
0
].
getValueData
());
}
}
if
(
!
isOneMerge
)
//settings for text
{
range
.
setFont
(
value2
[
numStyle
].
format
);
}
}
else
{
firstRange
.
setValue2
(
value2
);
}
};
var
applyPropertiesByRange
=
function
(
range
,
newVal
,
props
)
{
if
(
props
.
cellStyle
)
{
range
.
setCellStyle
(
props
.
cellStyle
);
}
if
(
props
.
val
)
{
range
.
setValue
(
props
.
val
);
}
if
(
props
.
numFormat
)
{
range
.
setNumFormat
(
props
.
numFormat
);
}
//for formula
setFormula
(
newVal
,
range
);
if
(
props
.
font
)
{
range
.
setFont
(
props
.
font
);
}
if
(
props
.
value2
)
{
range
.
setValue2
(
props
.
value2
);
}
if
(
props
.
alignVertical
)
{
range
.
setAlignVertical
(
props
.
alignVertical
);
}
if
(
props
.
alignHorizontal
)
{
range
.
setAlignHorizontal
(
props
.
alignHorizontal
);
}
if
(
props
.
fontSize
)
{
range
.
setFontsize
(
props
.
fontSize
);
}
if
(
props
.
offsetLast
)
{
range
.
setOffsetLast
(
props
.
offsetLast
);
}
if
(
props
.
merge
)
{
range
.
merge
(
props
.
merge
);
}
if
(
props
.
borders
)
{
range
.
setBorderSrc
(
props
.
borders
);
}
if
(
props
.
bordersFull
)
{
range
.
setBorder
(
props
.
bordersFull
);
}
if
(
props
.
wrap
)
{
range
.
setWrap
(
props
.
wrap
);
}
if
(
props
.
fill
)
{
range
.
setFill
(
props
.
fill
);
}
if
(
props
.
angle
)
{
range
.
setAngle
(
props
.
angle
);
}
if
(
props
.
hyperLink
)
{
var
_link
=
props
.
hyperLink
.
hyperLink
;
var
newHyperlink
=
new
AscCommonExcel
.
Hyperlink
();
if
(
_link
.
search
(
'
#
'
)
===
0
)
{
newHyperlink
.
setLocation
(
_link
.
replace
(
'
#
'
,
''
));
}
else
{
newHyperlink
.
Hyperlink
=
_link
;
}
newHyperlink
.
Ref
=
range
;
newHyperlink
.
Tooltip
=
props
.
hyperLink
;
range
.
setHyperlink
(
newHyperlink
);
}
if
(
props
.
hyperlinkObj
)
{
props
.
hyperlinkObj
.
Ref
=
range
;
range
.
setHyperlink
(
props
.
hyperlinkObj
,
true
);
}
};
var
putInsertedCellIntoRange
=
function
(
nRow
,
nCol
,
pasteRow
,
pasteCol
,
rowDiff
,
colDiff
,
range
,
newVal
)
{
var
pastedRangeProps
=
{};
//****paste comments****
if
(
val
.
aComments
&&
val
.
aComments
.
length
)
{
addComments
(
pasteRow
,
pasteCol
,
val
.
aComments
);
...
...
@@ -9542,7 +9310,7 @@
checkMerge
(
range
,
curMerge
,
nRow
,
nCol
,
rowDiff
,
colDiff
);
//set style
if
(
isOneMerge
)
{
if
(
!
isOneMerge
)
{
pastedRangeProps
.
cellStyle
=
newVal
.
getStyleName
();
}
...
...
@@ -9558,7 +9326,6 @@
pastedRangeProps
.
numFormat
=
nameFormat
;
}
if
(
!
isOneMerge
)
//settings for cell
{
//vertical align
...
...
@@ -9588,29 +9355,26 @@
}
//apply props by cell
applyPropertiesByRange
(
range
,
newVal
,
pastedRangeProps
);
t
.
_setPastedDataByCurrentRange
(
range
,
pastedRangeProps
,
firstRange
,
newVal
,
isOneMerge
,
arrFormula
,
tablesMap
);
};
var
newVal
;
var
curMerge
;
var
nRow
,
nCol
;
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
<
cMax
;
++
c
)
{
var
pasteRow
=
r
-
arn
.
r1
+
activeCellsPasteFragment
.
r1
;
var
pasteCol
=
c
-
arn
.
c1
+
activeCellsPasteFragment
.
c1
;
newVal
=
val
.
getCell3
(
pasteRow
,
pasteCol
);
var
newVal
=
val
.
getCell3
(
pasteRow
,
pasteCol
);
curMerge
=
newVal
.
hasMerged
();
var
curMerge
=
newVal
.
hasMerged
();
if
(
undefined
!==
newVal
)
{
nRow
=
r
+
autoR
*
plRow
;
var
nRow
=
r
+
autoR
*
plRow
;
if
(
nRow
>
gc_nMaxRow0
)
{
nRow
=
gc_nMaxRow0
;
}
nCol
=
c
+
autoC
*
plCol
;
var
nCol
=
c
+
autoC
*
plCol
;
if
(
nCol
>
gc_nMaxCol0
)
{
nCol
=
gc_nMaxCol0
;
}
...
...
@@ -9634,6 +9398,169 @@
return
arnFor
;
};
WorksheetView
.
prototype
.
_setPastedDataByCurrentRange
=
function
(
range
,
props
,
firstRange
,
newVal
,
isOneMerge
,
arrFormula
,
tablesMap
)
{
//set formula - for paste from binary
var
setFormula
=
function
(
newVal
,
firstRange
,
range
)
{
var
numFormula
=
null
;
var
skipFormat
=
null
;
var
noSkipVal
=
null
;
var
value2
=
newVal
.
getValue2
();
for
(
var
nF
=
0
;
nF
<
value2
.
length
;
nF
++
)
{
if
(
value2
[
nF
]
&&
value2
[
nF
].
sId
)
{
numFormula
=
nF
;
break
;
}
else
if
(
value2
[
nF
]
&&
value2
[
nF
].
format
&&
value2
[
nF
].
format
.
getSkip
())
{
skipFormat
=
true
;
}
else
if
(
value2
[
nF
]
&&
value2
[
nF
].
format
&&
!
value2
[
nF
].
format
.
getSkip
())
{
noSkipVal
=
nF
;
}
}
//TODO вместо range где возможно использовать cell
var
cellFrom
,
cellTo
;
if
(
value2
.
length
==
1
||
numFormula
!=
null
||
(
skipFormat
!=
null
&&
noSkipVal
!=
null
))
{
if
(
numFormula
==
null
)
{
numFormula
=
0
;
}
var
numStyle
=
0
;
if
(
skipFormat
!=
null
&&
noSkipVal
!=
null
)
{
numStyle
=
noSkipVal
;
}
//formula
if
(
newVal
.
getFormula
()
&&
!
isOneMerge
)
{
var
offset
=
range
.
getCells
()[
numFormula
].
getOffset2
(
value2
[
numFormula
].
sId
),
assemb
,
_p_
=
new
AscCommonExcel
.
parserFormula
(
value2
[
numFormula
].
sFormula
,
null
,
range
.
worksheet
);
if
(
_p_
.
parse
())
{
if
(
null
!==
tablesMap
)
{
var
renameParams
=
{};
renameParams
.
offset
=
offset
;
renameParams
.
tableNameMap
=
tablesMap
;
_p_
.
renameSheetCopy
(
renameParams
);
assemb
=
_p_
.
assemble
(
true
)
}
else
{
assemb
=
_p_
.
changeOffset
(
offset
).
assemble
(
true
);
}
arrFormula
.
push
({
range
:
range
,
val
:
"
=
"
+
assemb
});
}
}
else
{
cellFrom
=
newVal
.
getCells
();
if
(
isOneMerge
&&
range
&&
range
.
bbox
)
{
cellTo
=
this
.
_getCell
(
range
.
bbox
.
c1
,
range
.
bbox
.
r1
).
getCells
();
}
else
{
cellTo
=
firstRange
.
getCells
();
}
if
(
cellFrom
&&
cellTo
&&
cellFrom
[
0
]
&&
cellTo
[
0
])
{
cellTo
[
0
].
setValueData
(
cellFrom
[
0
].
getValueData
());
}
}
if
(
!
isOneMerge
)
//settings for text
{
range
.
setFont
(
value2
[
numStyle
].
format
);
}
}
else
{
firstRange
.
setValue2
(
value2
);
}
};
if
(
props
.
cellStyle
)
{
range
.
setCellStyle
(
props
.
cellStyle
);
}
if
(
props
.
val
)
{
range
.
setValue
(
props
.
val
);
}
if
(
props
.
numFormat
)
{
range
.
setNumFormat
(
props
.
numFormat
);
}
//for formula
if
(
newVal
)
{
setFormula
(
newVal
,
firstRange
,
range
);
}
if
(
props
.
font
)
{
range
.
setFont
(
props
.
font
);
}
if
(
props
.
value2
)
{
range
.
setValue2
(
props
.
value2
);
}
if
(
props
.
alignVertical
)
{
range
.
setAlignVertical
(
props
.
alignVertical
);
}
if
(
props
.
alignHorizontal
)
{
range
.
setAlignHorizontal
(
props
.
alignHorizontal
);
}
if
(
props
.
fontSize
)
{
range
.
setFontsize
(
props
.
fontSize
);
}
if
(
props
.
offsetLast
)
{
range
.
setOffsetLast
(
props
.
offsetLast
);
}
if
(
props
.
merge
)
{
range
.
merge
(
props
.
merge
);
}
if
(
props
.
borders
)
{
range
.
setBorderSrc
(
props
.
borders
);
}
if
(
props
.
bordersFull
)
{
range
.
setBorder
(
props
.
bordersFull
);
}
if
(
props
.
wrap
)
{
range
.
setWrap
(
props
.
wrap
);
}
if
(
props
.
fill
)
{
range
.
setFill
(
props
.
fill
);
}
if
(
props
.
angle
)
{
range
.
setAngle
(
props
.
angle
);
}
if
(
props
.
hyperLink
)
{
var
_link
=
props
.
hyperLink
.
hyperLink
;
var
newHyperlink
=
new
AscCommonExcel
.
Hyperlink
();
if
(
_link
.
search
(
'
#
'
)
===
0
)
{
newHyperlink
.
setLocation
(
_link
.
replace
(
'
#
'
,
''
));
}
else
{
newHyperlink
.
Hyperlink
=
_link
;
}
newHyperlink
.
Ref
=
range
;
newHyperlink
.
Tooltip
=
props
.
hyperLink
;
range
.
setHyperlink
(
newHyperlink
);
}
if
(
props
.
hyperlinkObj
)
{
props
.
hyperlinkObj
.
Ref
=
range
;
range
.
setHyperlink
(
props
.
hyperlinkObj
,
true
);
}
};
// Залочена ли панель для закрепления
WorksheetView
.
prototype
.
_isLockedFrozenPane
=
function
(
callback
)
{
...
...
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