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
83d0adc5
Commit
83d0adc5
authored
Aug 16, 2017
by
konovalovsergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
_getCellNoEmpty
parent
62fbf585
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
376 additions
and
295 deletions
+376
-295
cell/model/FormulaObjects/lookupandreferenceFunctions.js
cell/model/FormulaObjects/lookupandreferenceFunctions.js
+10
-3
cell/model/FormulaObjects/parserFormula.js
cell/model/FormulaObjects/parserFormula.js
+4
-3
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+8
-2
cell/model/Workbook.js
cell/model/Workbook.js
+299
-247
cell/view/WorksheetView.js
cell/view/WorksheetView.js
+55
-40
No files found.
cell/model/FormulaObjects/lookupandreferenceFunctions.js
View file @
83d0adc5
...
...
@@ -521,7 +521,7 @@
cLOOKUP
.
prototype
.
argumentsMin
=
2
;
cLOOKUP
.
prototype
.
argumentsMax
=
3
;
cLOOKUP
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
],
arg2
=
2
===
this
.
argumentsCurrent
?
arg1
:
arg
[
2
],
resC
=
-
1
,
resR
=
-
1
;
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
],
arg2
=
2
===
this
.
argumentsCurrent
?
arg1
:
arg
[
2
],
resC
=
-
1
,
resR
=
-
1
,
t
=
this
;
if
(
cElementType
.
error
===
arg0
.
type
)
{
return
this
.
value
=
arg0
;
...
...
@@ -586,7 +586,10 @@
}
var
c
=
new
CellAddress
(
BBox
.
r1
+
resR
,
BBox
.
c1
+
resC
,
0
);
return
this
.
value
=
checkTypeCell
(
_arg2
.
getWS
().
_getCellNoEmpty
(
c
.
getRow0
(),
c
.
getCol0
()));
_arg2
.
getWS
().
_getCellNoEmpty
(
c
.
getRow0
(),
c
.
getCol0
(),
function
(
cell
){
t
.
value
=
checkTypeCell
(
cell
);
});
return
this
.
value
;
}
else
{
if
(
cElementType
.
cellsRange3D
===
arg1
.
type
&&
!
arg1
.
isSingleSheet
()
||
cElementType
.
cellsRange3D
===
arg2
.
type
&&
!
arg2
.
isSingleSheet
())
{
...
...
@@ -1053,7 +1056,11 @@
r
=
this
.
bHor
?
bb
.
r1
+
number
:
res
;
c
=
this
.
bHor
?
res
:
bb
.
c1
+
number
;
return
checkTypeCell
(
arg1
.
getWS
().
_getCellNoEmpty
(
r
,
c
));
var
resVal
;
arg1
.
getWS
().
_getCellNoEmpty
(
r
,
c
,
function
(
cell
)
{
resVal
=
checkTypeCell
(
cell
);
});
return
resVal
;
};
VHLOOKUPCache
.
prototype
.
_get
=
function
(
range
,
valueForSearching
,
arg3Value
)
{
var
res
,
_this
=
this
,
wsId
=
range
.
getWorksheet
().
getId
(),
sRangeName
=
wsId
+
g_cCharDelimiter
+
...
...
cell/model/FormulaObjects/parserFormula.js
View file @
83d0adc5
...
...
@@ -1001,11 +1001,12 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
return
val
;
};
cArea
.
prototype
.
getValue2
=
function
(
i
,
j
)
{
var
res
=
this
.
index
(
i
+
1
,
j
+
1
),
r
,
cell
;
var
res
=
this
.
index
(
i
+
1
,
j
+
1
),
r
;
if
(
!
res
)
{
r
=
this
.
getRange
();
cell
=
r
.
worksheet
.
_getCellNoEmpty
(
r
.
bbox
.
r1
+
i
,
r
.
bbox
.
c1
+
j
);
res
=
checkTypeCell
(
cell
);
r
.
worksheet
.
_getCellNoEmpty
(
r
.
bbox
.
r1
+
i
,
r
.
bbox
.
c1
+
j
,
function
(
cell
)
{
res
=
checkTypeCell
(
cell
);
});
}
return
res
;
};
...
...
cell/model/FormulaObjects/statisticalFunctions.js
View file @
83d0adc5
...
...
@@ -1608,7 +1608,10 @@
var
offset
=
cell
.
getOffset3
(
r
.
bbox
.
c1
+
1
,
r
.
bbox
.
r1
+
1
);
r2
.
setOffset
(
offset
);
var
val
=
checkTypeCell
(
ws
.
_getCellNoEmpty
(
r2
.
bbox
.
r1
,
r2
.
bbox
.
c1
));
var
val
;
ws
.
_getCellNoEmpty
(
r2
.
bbox
.
r1
,
r2
.
bbox
.
c1
,
function
(
cell
)
{
val
=
checkTypeCell
(
cell
);
});
offset
.
offsetCol
*=
-
1
;
offset
.
offsetRow
*=
-
1
;
...
...
@@ -1622,7 +1625,10 @@
})
}
else
{
if
(
matching
(
arg0
.
getValue
(),
matchingInfo
))
{
var
val
=
checkTypeCell
(
ws
.
_getCellNoEmpty
(
r
.
bbox
.
r1
,
r2
.
bbox
.
c1
));
var
val
;
ws
.
_getCellNoEmpty
(
r
.
bbox
.
r1
,
r2
.
bbox
.
c1
,
function
(
cell
)
{
val
=
checkTypeCell
(
cell
);
});
if
(
cElementType
.
number
===
val
.
type
)
{
_sum
+=
val
.
getValue
();
_count
++
;
...
...
cell/model/Workbook.js
View file @
83d0adc5
This diff is collapsed.
Click to expand it.
cell/view/WorksheetView.js
View file @
83d0adc5
...
...
@@ -9669,7 +9669,6 @@
}
//TODO вместо range где возможно использовать cell
var
cellFrom
,
cellTo
;
if
(
value2
.
length
===
1
||
isFromula
!==
false
||
(
skipFormat
!=
null
&&
noSkipVal
!=
null
))
{
var
numStyle
=
0
;
if
(
skipFormat
!=
null
&&
noSkipVal
!=
null
)
{
...
...
@@ -9719,16 +9718,22 @@
}
}
else
{
//todo
cellFrom
=
newVal
.
getLeftTopCellNoEmpty
();
if
(
isOneMerge
&&
range
&&
range
.
bbox
)
{
cellTo
=
t
.
_getCell
(
range
.
bbox
.
c1
,
range
.
bbox
.
r1
).
getLeftTopCell
();
}
else
{
cellTo
=
firstRange
.
getLeftTopCell
();
}
newVal
.
getLeftTopCellNoEmpty
(
function
(
cellFrom
)
{
if
(
cellFrom
)
{
var
range
;
if
(
isOneMerge
&&
range
&&
range
.
bbox
)
{
range
=
t
.
_getCell
(
range
.
bbox
.
c1
,
range
.
bbox
.
r1
);
}
else
{
range
=
firstRange
;
}
range
.
getLeftTopCell
(
function
(
cellTo
)
{
if
(
cellTo
)
{
rangeStyle
.
cellValueData2
=
{
valueData
:
cellFrom
.
getValueData
(),
cell
:
cellTo
.
duplicate
()};
}
});
}
});
if
(
cellFrom
&&
cellTo
)
{
rangeStyle
.
cellValueData2
=
{
valueData
:
cellFrom
.
getValueData
(),
cell
:
cellTo
};
}
}
if
(
!
isOneMerge
)
//settings for text
...
...
@@ -11192,20 +11197,26 @@
if
(
!
maxCount
)
{
maxCount
=
Number
.
MAX_VALUE
;
}
var
count
=
0
,
cell
,
end
=
0
<
step
?
this
.
model
.
getRowsCount
()
-
1
:
var
count
=
0
,
isBreak
,
end
=
0
<
step
?
this
.
model
.
getRowsCount
()
-
1
:
0
,
isEnd
=
true
,
colsCount
=
this
.
model
.
getColsCount
(),
range
=
new
asc_Range
(
col
,
row
,
col
,
row
);
for
(;
row
*
step
<=
end
&&
count
<
maxCount
;
row
+=
step
,
isEnd
=
true
,
++
count
)
{
for
(
col
=
range
.
c1
;
col
<=
range
.
c2
;
++
col
)
{
cell
=
this
.
model
.
_getCellNoEmpty
(
row
,
col
);
if
(
cell
&&
false
===
cell
.
isEmptyText
())
{
isEnd
=
false
;
break
;
}
this
.
model
.
_getCellNoEmpty
(
row
,
col
,
function
(
cell
)
{
if
(
cell
&&
false
===
cell
.
isEmptyText
())
{
isEnd
=
false
;
isBreak
=
true
;
}
});
if
(
isBreak
)
{
break
;
}
}
// Идем влево по колонкам
for
(
col
=
range
.
c1
-
1
;
col
>=
0
;
--
col
)
{
cell
=
this
.
model
.
_getCellNoEmpty
(
row
,
col
);
if
(
null
===
cell
||
cell
.
isEmptyText
())
{
this
.
model
.
_getCellNoEmpty
(
row
,
col
,
function
(
cell
)
{
isBreak
=
(
null
===
cell
||
cell
.
isEmptyText
());
});
if
(
isBreak
)
{
break
;
}
isEnd
=
false
;
...
...
@@ -11213,8 +11224,10 @@
range
.
c1
=
col
+
1
;
// Идем вправо по колонкам
for
(
col
=
range
.
c2
+
1
;
col
<
colsCount
;
++
col
)
{
cell
=
this
.
model
.
_getCellNoEmpty
(
row
,
col
);
if
(
null
===
cell
||
cell
.
isEmptyText
())
{
this
.
model
.
_getCellNoEmpty
(
row
,
col
,
function
(
cell
)
{
isBreak
=
(
null
===
cell
||
cell
.
isEmptyText
());
});
if
(
isBreak
)
{
break
;
}
isEnd
=
false
;
...
...
@@ -11238,19 +11251,20 @@
if
(
null
===
range
)
{
return
;
}
var
row
,
cell
,
value
,
valueLowCase
;
var
row
,
value
,
valueLowCase
;
for
(
row
=
range
.
r1
;
row
<=
range
.
r2
;
++
row
)
{
cell
=
this
.
model
.
_getCellNoEmpty
(
row
,
col
);
if
(
cell
)
{
value
=
cell
.
getValue
();
if
(
!
AscCommon
.
isNumber
(
value
))
{
valueLowCase
=
value
.
toLowerCase
();
if
(
!
objValues
.
hasOwnProperty
(
valueLowCase
))
{
arrValues
.
push
(
value
);
objValues
[
valueLowCase
]
=
1
;
}
}
}
this
.
model
.
_getCellNoEmpty
(
row
,
col
,
function
(
cell
){
if
(
cell
)
{
value
=
cell
.
getValue
();
if
(
!
AscCommon
.
isNumber
(
value
))
{
valueLowCase
=
value
.
toLowerCase
();
if
(
!
objValues
.
hasOwnProperty
(
valueLowCase
))
{
arrValues
.
push
(
value
);
objValues
[
valueLowCase
]
=
1
;
}
}
}
});
}
};
...
...
@@ -12426,20 +12440,21 @@
this
.
_updateCellsRange
(
oAllRange
.
bbox
);
// ToDo Стоит обновить nRowsCount и nColsCount
};
WorksheetView
.
prototype
.
getData
=
function
()
{
var
arrResult
,
arrCells
=
[],
c
ell
,
c
,
r
,
row
,
lastC
=
-
1
,
lastR
=
-
1
,
val
;
var
arrResult
,
arrCells
=
[],
c
,
r
,
row
,
lastC
=
-
1
,
lastR
=
-
1
,
val
;
var
maxCols
=
Math
.
min
(
this
.
model
.
getColsCount
(),
gc_nMaxCol
);
var
maxRows
=
Math
.
min
(
this
.
model
.
getRowsCount
(),
gc_nMaxRow
);
for
(
r
=
0
;
r
<
maxRows
;
++
r
)
{
row
=
[];
for
(
c
=
0
;
c
<
maxCols
;
++
c
)
{
cell
=
this
.
model
.
_getCellNoEmpty
(
r
,
c
);
if
(
cell
&&
''
!==
(
val
=
cell
.
getValue
()))
{
lastC
=
Math
.
max
(
lastC
,
c
);
lastR
=
Math
.
max
(
lastR
,
r
);
}
else
{
val
=
''
;
}
this
.
model
.
_getCellNoEmpty
(
r
,
c
,
function
(
cell
)
{
if
(
cell
&&
''
!==
(
val
=
cell
.
getValue
()))
{
lastC
=
Math
.
max
(
lastC
,
c
);
lastR
=
Math
.
max
(
lastR
,
r
);
}
else
{
val
=
''
;
}
});
row
.
push
(
val
);
}
arrCells
.
push
(
row
);
...
...
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