[SSE] Bug 37388 (insert worksheet)

This commit is contained in:
Julia Svinareva 2019-10-09 10:06:30 +03:00
parent 035143f644
commit 8e1fb526c0

View file

@ -254,8 +254,12 @@ define([
});
switch (item.value) {
case 'ins':
var arrNames = [];
for(var i = 0; i < arrIndex.length; i++) {
arrNames.push(me.createSheetName(arrNames));
}
setTimeout(function () {
me.api.asc_insertWorksheet(me.createSheetName());
me.api.asc_insertWorksheet(arrNames);
}, 1);
break;
case 'del':
@ -278,7 +282,7 @@ define([
}
},
createSheetName: function() {
createSheetName: function(curArrNames) {
var items = [], wc = this.api.asc_getWorksheetsCount();
while (wc--) {
items.push(this.api.asc_getWorksheetName(wc).toLowerCase());
@ -290,6 +294,17 @@ define([
if (items.indexOf(name.toLowerCase()) < 0) break;
}
if (curArrNames && curArrNames.length > 0) {
var arr = [];
curArrNames.forEach(function (item) {
arr.push(item.toLowerCase());
});
while(arr.indexOf(name.toLowerCase()) !== -1) {
index++;
name = this.strSheet + index;
}
}
return name;
},