Commit 83d0adc5 authored by konovalovsergey's avatar konovalovsergey

_getCellNoEmpty

parent 62fbf585
...@@ -521,7 +521,7 @@ ...@@ -521,7 +521,7 @@
cLOOKUP.prototype.argumentsMin = 2; cLOOKUP.prototype.argumentsMin = 2;
cLOOKUP.prototype.argumentsMax = 3; cLOOKUP.prototype.argumentsMax = 3;
cLOOKUP.prototype.Calculate = function (arg) { 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) { if (cElementType.error === arg0.type) {
return this.value = arg0; return this.value = arg0;
...@@ -586,7 +586,10 @@ ...@@ -586,7 +586,10 @@
} }
var c = new CellAddress(BBox.r1 + resR, BBox.c1 + resC, 0); 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 { } else {
if (cElementType.cellsRange3D === arg1.type && !arg1.isSingleSheet() || if (cElementType.cellsRange3D === arg1.type && !arg1.isSingleSheet() ||
cElementType.cellsRange3D === arg2.type && !arg2.isSingleSheet()) { cElementType.cellsRange3D === arg2.type && !arg2.isSingleSheet()) {
...@@ -1053,7 +1056,11 @@ ...@@ -1053,7 +1056,11 @@
r = this.bHor ? bb.r1 + number : res; r = this.bHor ? bb.r1 + number : res;
c = this.bHor ? res : bb.c1 + number; 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) { VHLOOKUPCache.prototype._get = function (range, valueForSearching, arg3Value) {
var res, _this = this, wsId = range.getWorksheet().getId(), sRangeName = wsId + g_cCharDelimiter + var res, _this = this, wsId = range.getWorksheet().getId(), sRangeName = wsId + g_cCharDelimiter +
......
...@@ -1001,11 +1001,12 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara ...@@ -1001,11 +1001,12 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
return val; return val;
}; };
cArea.prototype.getValue2 = function (i, j) { 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) { if (!res) {
r = this.getRange(); r = this.getRange();
cell = r.worksheet._getCellNoEmpty(r.bbox.r1 + i, r.bbox.c1 + j); r.worksheet._getCellNoEmpty(r.bbox.r1 + i, r.bbox.c1 + j, function(cell) {
res = checkTypeCell(cell); res = checkTypeCell(cell);
});
} }
return res; return res;
}; };
......
...@@ -1608,7 +1608,10 @@ ...@@ -1608,7 +1608,10 @@
var offset = cell.getOffset3(r.bbox.c1 + 1, r.bbox.r1 + 1); var offset = cell.getOffset3(r.bbox.c1 + 1, r.bbox.r1 + 1);
r2.setOffset(offset); 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.offsetCol *= -1;
offset.offsetRow *= -1; offset.offsetRow *= -1;
...@@ -1622,7 +1625,10 @@ ...@@ -1622,7 +1625,10 @@
}) })
} else { } else {
if (matching(arg0.getValue(), matchingInfo)) { 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) { if (cElementType.number === val.type) {
_sum += val.getValue(); _sum += val.getValue();
_count++; _count++;
......
This diff is collapsed.
...@@ -9669,7 +9669,6 @@ ...@@ -9669,7 +9669,6 @@
} }
//TODO вместо range где возможно использовать cell //TODO вместо range где возможно использовать cell
var cellFrom, cellTo;
if (value2.length === 1 || isFromula !== false || (skipFormat != null && noSkipVal != null)) { if (value2.length === 1 || isFromula !== false || (skipFormat != null && noSkipVal != null)) {
var numStyle = 0; var numStyle = 0;
if (skipFormat != null && noSkipVal != null) { if (skipFormat != null && noSkipVal != null) {
...@@ -9719,16 +9718,22 @@ ...@@ -9719,16 +9718,22 @@
} }
} else { } else {
//todo //todo
cellFrom = newVal.getLeftTopCellNoEmpty(); newVal.getLeftTopCellNoEmpty(function(cellFrom) {
if (isOneMerge && range && range.bbox) { if (cellFrom) {
cellTo = t._getCell(range.bbox.c1, range.bbox.r1).getLeftTopCell(); var range;
} else { if (isOneMerge && range && range.bbox) {
cellTo = firstRange.getLeftTopCell(); 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 if (!isOneMerge)//settings for text
...@@ -11192,20 +11197,26 @@ ...@@ -11192,20 +11197,26 @@
if (!maxCount) { if (!maxCount) {
maxCount = Number.MAX_VALUE; 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); 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 (; row * step <= end && count < maxCount; row += step, isEnd = true, ++count) {
for (col = range.c1; col <= range.c2; ++col) { for (col = range.c1; col <= range.c2; ++col) {
cell = this.model._getCellNoEmpty(row, col); this.model._getCellNoEmpty(row, col, function(cell) {
if (cell && false === cell.isEmptyText()) { if (cell && false === cell.isEmptyText()) {
isEnd = false; isEnd = false;
break; isBreak = true;
} }
});
if (isBreak) {
break;
}
} }
// Идем влево по колонкам // Идем влево по колонкам
for (col = range.c1 - 1; col >= 0; --col) { for (col = range.c1 - 1; col >= 0; --col) {
cell = this.model._getCellNoEmpty(row, col); this.model._getCellNoEmpty(row, col, function(cell) {
if (null === cell || cell.isEmptyText()) { isBreak = (null === cell || cell.isEmptyText());
});
if (isBreak) {
break; break;
} }
isEnd = false; isEnd = false;
...@@ -11213,8 +11224,10 @@ ...@@ -11213,8 +11224,10 @@
range.c1 = col + 1; range.c1 = col + 1;
// Идем вправо по колонкам // Идем вправо по колонкам
for (col = range.c2 + 1; col < colsCount; ++col) { for (col = range.c2 + 1; col < colsCount; ++col) {
cell = this.model._getCellNoEmpty(row, col); this.model._getCellNoEmpty(row, col, function(cell) {
if (null === cell || cell.isEmptyText()) { isBreak = (null === cell || cell.isEmptyText());
});
if (isBreak) {
break; break;
} }
isEnd = false; isEnd = false;
...@@ -11238,19 +11251,20 @@ ...@@ -11238,19 +11251,20 @@
if (null === range) { if (null === range) {
return; return;
} }
var row, cell, value, valueLowCase; var row, value, valueLowCase;
for (row = range.r1; row <= range.r2; ++row) { for (row = range.r1; row <= range.r2; ++row) {
cell = this.model._getCellNoEmpty(row, col); this.model._getCellNoEmpty(row, col, function(cell){
if (cell) { if (cell) {
value = cell.getValue(); value = cell.getValue();
if (!AscCommon.isNumber(value)) { if (!AscCommon.isNumber(value)) {
valueLowCase = value.toLowerCase(); valueLowCase = value.toLowerCase();
if (!objValues.hasOwnProperty(valueLowCase)) { if (!objValues.hasOwnProperty(valueLowCase)) {
arrValues.push(value); arrValues.push(value);
objValues[valueLowCase] = 1; objValues[valueLowCase] = 1;
} }
} }
} }
});
} }
}; };
...@@ -12426,20 +12440,21 @@ ...@@ -12426,20 +12440,21 @@
this._updateCellsRange(oAllRange.bbox); // ToDo Стоит обновить nRowsCount и nColsCount this._updateCellsRange(oAllRange.bbox); // ToDo Стоит обновить nRowsCount и nColsCount
}; };
WorksheetView.prototype.getData = function () { WorksheetView.prototype.getData = function () {
var arrResult, arrCells = [], cell, 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 maxCols = Math.min(this.model.getColsCount(), gc_nMaxCol);
var maxRows = Math.min(this.model.getRowsCount(), gc_nMaxRow); var maxRows = Math.min(this.model.getRowsCount(), gc_nMaxRow);
for (r = 0; r < maxRows; ++r) { for (r = 0; r < maxRows; ++r) {
row = []; row = [];
for (c = 0; c < maxCols; ++c) { for (c = 0; c < maxCols; ++c) {
cell = this.model._getCellNoEmpty(r, c); this.model._getCellNoEmpty(r, c, function(cell) {
if (cell && '' !== (val = cell.getValue())) { if (cell && '' !== (val = cell.getValue())) {
lastC = Math.max(lastC, c); lastC = Math.max(lastC, c);
lastR = Math.max(lastR, r); lastR = Math.max(lastR, r);
} else { } else {
val = ''; val = '';
} }
});
row.push(val); row.push(val);
} }
arrCells.push(row); arrCells.push(row);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment