Commit 3b514ca3 authored by GoshaZotov's avatar GoshaZotov

+ previous

parent 8ecfbee5
...@@ -2479,31 +2479,26 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara ...@@ -2479,31 +2479,26 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
} }
}; };
if (cElementType.cellsRange === arg.type || cElementType.cellsRange3D === arg.type) { if (cElementType.cellsRange === arg.type || cElementType.cellsRange3D === arg.type || cElementType.array === arg.type) {
arg = arg.getMatrix();
if (cElementType.cellsRange === arg.type || cElementType.array === arg.type) {
arg = arg.getMatrix();
} else if (cElementType.cellsRange3D === arg.type) {
arg = arg.getMatrix()[0];
}
for (var i = 0; i < arg.length; i++) { for (var i = 0; i < arg.length; i++) {
for (var j = 0; j < arg[i].length; j++) { for (var j = 0; j < arg[i].length; j++) {
if(cElementType.error === arg[i][j].type){ if(cElementType.error === arg[i][j].type){
res = arg[i][j]; return arg[i][j];
break;
}else{ }else{
res.push(getValue(arg[i][j])); res.push(getValue(arg[i][j]));
} }
} }
} }
}else if(cElementType.array === arg.type){
arg.foreach(function (elem) {
if(cElementType.error === elem.type){
res = elem;
return;
}else{
res.push(getValue(elem));
}
})
}else{ }else{
if(cElementType.error === arg.type){ if(cElementType.error === arg.type){
res = elem; return arg;
return;
}else{ }else{
res.push(getValue(arg)); res.push(getValue(arg));
} }
......
...@@ -1802,6 +1802,7 @@ ...@@ -1802,6 +1802,7 @@
cTEXTJOIN.prototype = Object.create(cBaseFunction.prototype); cTEXTJOIN.prototype = Object.create(cBaseFunction.prototype);
cTEXTJOIN.prototype.constructor = cTEXTJOIN; cTEXTJOIN.prototype.constructor = cTEXTJOIN;
cTEXTJOIN.prototype.argumentsMin = 3; cTEXTJOIN.prototype.argumentsMin = 3;
cTEXTJOIN.prototype.argumentsMax = 255;
cTEXTJOIN.prototype.numFormat = AscCommonExcel.cNumFormatNone; cTEXTJOIN.prototype.numFormat = AscCommonExcel.cNumFormatNone;
cTEXTJOIN.prototype.isXLFN = true; cTEXTJOIN.prototype.isXLFN = true;
cTEXTJOIN.prototype.Calculate = function (arg) { cTEXTJOIN.prototype.Calculate = function (arg) {
...@@ -1817,7 +1818,9 @@ ...@@ -1817,7 +1818,9 @@
var ignore_empty = argClone[1].toBool(); var ignore_empty = argClone[1].toBool();
var delimiter = argClone[0]; var delimiter = argClone[0];
var delimiterIter = 0; var delimiterIter = 0;
//разделитель может быть в виде массива, где используются все его элементы
var delimiterArr = this._getOneDimensionalArray(delimiter); var delimiterArr = this._getOneDimensionalArray(delimiter);
//если хотя бы один элемент ошибка, то возвращаем ошибку
if(delimiterArr instanceof cError){ if(delimiterArr instanceof cError){
return this.value = delimiterArr; return this.value = delimiterArr;
} }
...@@ -1828,16 +1831,17 @@ ...@@ -1828,16 +1831,17 @@
return res; return res;
} }
var isStartStr = string1 === ""; var isStartStr = string1 === "";
var delimeterStr = isStartStr ? "" : delimiterArr[delimiterIter]; //выбираем разделитель из массива по порядку
if(undefined === delimeterStr){ var delimiterStr = isStartStr ? "" : delimiterArr[delimiterIter];
if(undefined === delimiterStr){
delimiterIter = 0; delimiterIter = 0;
delimeterStr = delimiterArr[delimiterIter]; delimiterStr = delimiterArr[delimiterIter];
} }
if(!isStartStr){ if(!isStartStr){
delimiterIter++; delimiterIter++;
} }
res += delimeterStr + string2; res += delimiterStr + string2;
return res; return res;
}; };
...@@ -1845,30 +1849,27 @@ ...@@ -1845,30 +1849,27 @@
for (var i = 2; i < this.argumentsCurrent; i++) { for (var i = 2; i < this.argumentsCurrent; i++) {
argI = arg[i]; argI = arg[i];
if(argI instanceof cArea || argI instanceof cArray || argI instanceof cArea3D){ var type = argI.type;
if (argI instanceof cArea || argI instanceof cArray) { if(cElementType.cellsRange === type || cElementType.cellsRange3D === type || cElementType.array === type){
argI = argI.getMatrix(); //получаем одномерный массив
} else if (argI instanceof cArea3D) { argI = this._getOneDimensionalArray(argI);
argI = argI.getMatrix()[0];
//если хотя бы один элемент с ошибкой, возвращаем ошибку
if (argI instanceof cError) {
return this.value = argI;
} }
for (var n = 0; n < argI.length; n++) { for (var n = 0; n < argI.length; n++) {
for (var j = 0; j < argI[n].length; j++) { arg0 = new cString(concatString(arg0.toString(), argI[n].toString()));
if(cElementType.error === argI[n][j].type){
return this.value = argI[n][j];
}else{
arg0 = new cString(concatString(arg0.toString(), argI[n][j].toString()));
}
}
} }
}else{ }else{
argI = argI.tocString(); argI = argI.tocString();
if (arg0 instanceof cError) { if (argI instanceof cError) {
return this.value = arg0; return this.value = argI;
}else{
arg0 = new cString(concatString(arg0.toString(), argI.toString()));
} }
arg0 = new cString(concatString(arg0.toString(), argI.toString()));
} }
} }
......
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