Commit c7c3854b authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

для Bug 24727 - [XLSX] Таблица открывается с ошибкой в консоли eCell is not defined

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56640 954022d7-b5bf-4e40-9824-e11837661b57
parent 7cb94c02
......@@ -967,12 +967,13 @@ var gUndoInsDelCellsFlag = true;
var startCol = allFil.c1;
var endCol = allFil.c2;
var endRow = allFil.r2;
//проверяем диапазон
if(ws.cols.length < eCell.first.col)
ws.expandColsOnScroll(false,true,eCell.first.col);
if(ws.rows.length < eCell.first.row)
ws.expandColsOnScroll(false,true,eCell.first.row);
if (ws.cols.length < endCol)
ws.expandColsOnScroll(false, true, endCol);
if (ws.rows.length < endRow)
ws.expandRowsOnScroll(false, true, endRow);
for(var col = startCol; col <= endCol; col++)
{
var idCell = new CellAddress(allFil.r1, col, 0);
......@@ -4940,7 +4941,7 @@ var gUndoInsDelCellsFlag = true;
//change current filter after insert column
_editFilterAfterInsertColumn: function(cRange,val,col,type,activeCells)
{
console.time("test");
console.time("test");
var bUndoChanges = this.worksheet.model.workbook.bUndoChanges;
var bRedoChanges = this.worksheet.model.workbook.bRedoChanges;
var ws = this.worksheet;
......@@ -4958,7 +4959,7 @@ var gUndoInsDelCellsFlag = true;
filter = aWs.TableParts[cRange.index].clone(aWs);
if(filter.AutoFilter)
filterColums = filter.AutoFilter.FilterColumns;
};
};
var oldFilter = filter.clone(aWs);
......@@ -5095,10 +5096,10 @@ var gUndoInsDelCellsFlag = true;
else
cRange.end.c1 = cRange.end.c1 + val;
//filter.Ref = this._rangeToId(cRange.start) + ":" + this._rangeToId(cRange.end);
//change result into filter and change info in button
filter = this._changeInfoFilterAfterInsertCols(filter, type, col, cRange, val, filterColums, activeCells);
//filter.Ref = this._rangeToId(cRange.start) + ":" + this._rangeToId(cRange.end);
//change result into filter and change info in button
filter = this._changeInfoFilterAfterInsertCols(filter, type, col, cRange, val, filterColums, activeCells);
//записываем в историю, если активная область касается данных фильтров
if(!bUndoChanges && !bRedoChanges && val < 0)
......@@ -5113,275 +5114,275 @@ var gUndoInsDelCellsFlag = true;
this._addHistoryObj(changeElement, null, null, true);
History.EndTransaction();
}
};
if(cRange.index == 'all')
{
aWs.AutoFilter = filter;
}
else
{
aWs.TableParts[cRange.index] = filter;
};
};
if(cRange.index == 'all')
{
aWs.AutoFilter = filter;
}
else
{
aWs.TableParts[cRange.index] = filter;
};
console.timeEnd("test");
},
_changeInfoFilterAfterInsertCols: function(filter, type, col, cRange, val, filterColums, activeCells)
{
var ws = this.worksheet;
var inFilter = Asc.Range(cRange.start.c1, cRange.start.r1, cRange.end.c1, cRange.end.r1);
var cloneFilterColums = [];
if(filterColums)
{
for(var k = 0; k < filterColums.length; k++)
{
cloneFilterColums[k] = filterColums[k].clone();
}
};
if(filter.result && filter.result.length > 0)
{
//change array
var changeNum = [];
var newResult = [];
var n = 0;
var isChangeColumn = false;
var insertIndexes = [];
for(var filR = 0; filR < filter.result.length; filR++)
{
var endCount = 0;
var curFilter = filter.result[filR];
var newFirstCol = this._idToRange(curFilter.id);
var newFirstColCell = newFirstCol.c1;
if(type == 'insRow')
newFirstColCell = newFirstCol.r1;
//добавляем колонку(колонки), вставляем новый фильтр
if(newFirstColCell == col)
{
for(var insCol = 1; insCol <= val; insCol++)
{
var localChangeCol = this._idToRange(curFilter.id);
var localNextCol = this._idToRange(curFilter.idNext);
if(type == 'insRow')
{
localChangeCol.r1 = localChangeCol.r1 + insCol - 1;
localNextCol.r1 = localNextCol.r1 + insCol - 1;
}
else
{
localChangeCol.c1 = localChangeCol.c1 + insCol - 1;
localNextCol.c1 = localNextCol.c1 + insCol - 1;
}
var id = this._rangeToId(localChangeCol);
var nextId = this._rangeToId(localNextCol);
newResult[n] = new Result();
newResult[n].x =curFilter.x;
newResult[n].y = curFilter.y;
newResult[n].width = curFilter.width;
newResult[n].height = curFilter.height;
newResult[n].id = id;
newResult[n].idNext = nextId;
newResult[n].hiddenRows = [];
var num = 1;
this._changeContentButton(newResult[n],num,'add',inFilter);
//changeNum[insCol - 1] = n;
n++;
}
if(val < 0)//удаляем кнопки в случае удаления ячеек
{
this._changeContentButton(curFilter,Math.abs(val),'del',inFilter);
//убираем примененный фильтр
if(filterColums)
{
for(var zF = filR; zF < filR + Math.abs(val); zF++)
{
for(var s = 0; s < cloneFilterColums.length; s++)
{
if(zF == cloneFilterColums[s].ColId)
cloneFilterColums.splice(s,1);
}
}
}
filR = filR + Math.abs(val) - 1;
}
else
{
var newNextCol = this._idToRange(curFilter.idNext);
if(type == 'insRow')
{
newFirstCol.r1 = newFirstCol.r1 + val;
newNextCol.r1 = newNextCol.r1 + val;
}
else
{
newFirstCol.c1 = newFirstCol.c1 + val;
newNextCol.c1 = newNextCol.c1 + val;
}
var id = this._rangeToId(newFirstCol);
var nextId = this._rangeToId(newNextCol);
curFilter.inFilter = inFilter;
curFilter.id = id;
curFilter.idNext = nextId;
newResult[n] = curFilter;
//смещаем примененный фильтр(у filter.FilterColumns просматриваем colId)
if(filterColums)
{
for(var s = 0; s < filterColums.length; s++)
{
if(filterColums[s].ColId == filR && filR > endCount)
{
cloneFilterColums[s].ColId = filR + val;
endCount = filR + val;
break;
}
}
}
n++;
}
}
else if(newFirstColCell < col)
{
if(type == 'insRow')
{
var newNextCol = this._idToRange(curFilter.idNext);
newNextCol.r1 = newNextCol.r1 + val;
var nextId = this._rangeToId(newNextCol);
curFilter.idNext = nextId;
}
curFilter.inFilter = inFilter;
newResult[n] = curFilter;
n++;
}
else
{
var newNextCol = this._idToRange(curFilter.idNext);
if(type == 'insRow')
{
newFirstCol.r1 = newFirstCol.r1 + val;
newNextCol.r1 = newNextCol.r1 + val;
}
else
{
newFirstCol.c1 = newFirstCol.c1 + val;
newNextCol.c1 = newNextCol.c1 + val;
}
var id = this._rangeToId(newFirstCol);
var nextId = this._rangeToId(newNextCol);
var oldId = curFilter.id;
curFilter.inFilter = inFilter;
curFilter.id = id;
curFilter.idNext = nextId;
newResult[n] = curFilter;
if(type == 'insCol')
this._changeContentButton(newResult[n], null,'change', null, oldId);
//смещаем примененный фильтр(у filter.FilterColumns просматриваем colId)
if(filterColums)
{
for(var s = 0; s < filterColums.length; s++)
{
if(filterColums[s].ColId == filR && filR > endCount)
{
cloneFilterColums[s].ColId = filR + val;
endCount = filR + val;
break;
}
}
}
n++;
}
};
if(type == 'insCol')
{
for(var n = 0; n < newResult.length; n++)
{
this._changeContentButton(newResult[n], 1, 'add', inFilter);
}
};
if(cloneFilterColums)
{
if(cRange.index == 'all')
{
filter.FilterColumns = cloneFilterColums;
filter.Ref = inFilter;
}
else
{
if(filter.AutoFilter)
filter.AutoFilter.FilterColumns = cloneFilterColums;
filter.AutoFilter.Ref = inFilter;
}
};
//change tableColumn
if(filter.TableColumns && type != 'insRow')
{
var newTableColumn = [];
var startCell = col - inFilter.c1;
var isN = 0;
if(newResult.length < filter.TableColumns.length)
{
filter.TableColumns.splice(startCell,filter.TableColumns.length - newResult.length)
}
else
{
for(var l = 0; l < newResult.length; l++)
{
if(startCell == l)
{
for(var s = 0; s < val; s++)
{
var range2 = this._idToRange(newResult[0].id);
if(s != 0)
l = l + 1;
var tempArray = newTableColumn.concat(filter.TableColumns);
var newNameColumn = this._generateColumnName(tempArray, startCell - 1);
newTableColumn[l] = new TableColumn();
newTableColumn[l].Name = newNameColumn;
ws.model.getCell(new CellAddress(range2.r1,range2.c1 + l,0)).setValue(newNameColumn);
}
}
else
{
var columnValue = filter.TableColumns[isN].Name;
newTableColumn[l] = new TableColumn();
newTableColumn[l].Name = columnValue;
isN++;
}
}
filter.TableColumns = newTableColumn;
}
};
filter.result = newResult;
filter.Ref = inFilter;
if(val > 0)
this._addButtonAF(newResult);
return filter;
};
},
_changeInfoFilterAfterInsertCols: function(filter, type, col, cRange, val, filterColums, activeCells)
{
var ws = this.worksheet;
var inFilter = Asc.Range(cRange.start.c1, cRange.start.r1, cRange.end.c1, cRange.end.r1);
var cloneFilterColums = [];
if(filterColums)
{
for(var k = 0; k < filterColums.length; k++)
{
cloneFilterColums[k] = filterColums[k].clone();
}
};
if(filter.result && filter.result.length > 0)
{
//change array
var changeNum = [];
var newResult = [];
var n = 0;
var isChangeColumn = false;
var insertIndexes = [];
for(var filR = 0; filR < filter.result.length; filR++)
{
var endCount = 0;
var curFilter = filter.result[filR];
var newFirstCol = this._idToRange(curFilter.id);
var newFirstColCell = newFirstCol.c1;
if(type == 'insRow')
newFirstColCell = newFirstCol.r1;
//добавляем колонку(колонки), вставляем новый фильтр
if(newFirstColCell == col)
{
for(var insCol = 1; insCol <= val; insCol++)
{
var localChangeCol = this._idToRange(curFilter.id);
var localNextCol = this._idToRange(curFilter.idNext);
if(type == 'insRow')
{
localChangeCol.r1 = localChangeCol.r1 + insCol - 1;
localNextCol.r1 = localNextCol.r1 + insCol - 1;
}
else
{
localChangeCol.c1 = localChangeCol.c1 + insCol - 1;
localNextCol.c1 = localNextCol.c1 + insCol - 1;
}
var id = this._rangeToId(localChangeCol);
var nextId = this._rangeToId(localNextCol);
newResult[n] = new Result();
newResult[n].x =curFilter.x;
newResult[n].y = curFilter.y;
newResult[n].width = curFilter.width;
newResult[n].height = curFilter.height;
newResult[n].id = id;
newResult[n].idNext = nextId;
newResult[n].hiddenRows = [];
var num = 1;
this._changeContentButton(newResult[n],num,'add',inFilter);
//changeNum[insCol - 1] = n;
n++;
}
if(val < 0)//удаляем кнопки в случае удаления ячеек
{
this._changeContentButton(curFilter,Math.abs(val),'del',inFilter);
//убираем примененный фильтр
if(filterColums)
{
for(var zF = filR; zF < filR + Math.abs(val); zF++)
{
for(var s = 0; s < cloneFilterColums.length; s++)
{
if(zF == cloneFilterColums[s].ColId)
cloneFilterColums.splice(s,1);
}
}
}
filR = filR + Math.abs(val) - 1;
}
else
{
var newNextCol = this._idToRange(curFilter.idNext);
if(type == 'insRow')
{
newFirstCol.r1 = newFirstCol.r1 + val;
newNextCol.r1 = newNextCol.r1 + val;
}
else
{
newFirstCol.c1 = newFirstCol.c1 + val;
newNextCol.c1 = newNextCol.c1 + val;
}
var id = this._rangeToId(newFirstCol);
var nextId = this._rangeToId(newNextCol);
curFilter.inFilter = inFilter;
curFilter.id = id;
curFilter.idNext = nextId;
newResult[n] = curFilter;
//смещаем примененный фильтр(у filter.FilterColumns просматриваем colId)
if(filterColums)
{
for(var s = 0; s < filterColums.length; s++)
{
if(filterColums[s].ColId == filR && filR > endCount)
{
cloneFilterColums[s].ColId = filR + val;
endCount = filR + val;
break;
}
}
}
n++;
}
}
else if(newFirstColCell < col)
{
if(type == 'insRow')
{
var newNextCol = this._idToRange(curFilter.idNext);
newNextCol.r1 = newNextCol.r1 + val;
var nextId = this._rangeToId(newNextCol);
curFilter.idNext = nextId;
}
curFilter.inFilter = inFilter;
newResult[n] = curFilter;
n++;
}
else
{
var newNextCol = this._idToRange(curFilter.idNext);
if(type == 'insRow')
{
newFirstCol.r1 = newFirstCol.r1 + val;
newNextCol.r1 = newNextCol.r1 + val;
}
else
{
newFirstCol.c1 = newFirstCol.c1 + val;
newNextCol.c1 = newNextCol.c1 + val;
}
var id = this._rangeToId(newFirstCol);
var nextId = this._rangeToId(newNextCol);
var oldId = curFilter.id;
curFilter.inFilter = inFilter;
curFilter.id = id;
curFilter.idNext = nextId;
newResult[n] = curFilter;
if(type == 'insCol')
this._changeContentButton(newResult[n], null,'change', null, oldId);
//смещаем примененный фильтр(у filter.FilterColumns просматриваем colId)
if(filterColums)
{
for(var s = 0; s < filterColums.length; s++)
{
if(filterColums[s].ColId == filR && filR > endCount)
{
cloneFilterColums[s].ColId = filR + val;
endCount = filR + val;
break;
}
}
}
n++;
}
};
if(type == 'insCol')
{
for(var n = 0; n < newResult.length; n++)
{
this._changeContentButton(newResult[n], 1, 'add', inFilter);
}
};
if(cloneFilterColums)
{
if(cRange.index == 'all')
{
filter.FilterColumns = cloneFilterColums;
filter.Ref = inFilter;
}
else
{
if(filter.AutoFilter)
filter.AutoFilter.FilterColumns = cloneFilterColums;
filter.AutoFilter.Ref = inFilter;
}
};
//change tableColumn
if(filter.TableColumns && type != 'insRow')
{
var newTableColumn = [];
var startCell = col - inFilter.c1;
var isN = 0;
if(newResult.length < filter.TableColumns.length)
{
filter.TableColumns.splice(startCell,filter.TableColumns.length - newResult.length)
}
else
{
for(var l = 0; l < newResult.length; l++)
{
if(startCell == l)
{
for(var s = 0; s < val; s++)
{
var range2 = this._idToRange(newResult[0].id);
if(s != 0)
l = l + 1;
var tempArray = newTableColumn.concat(filter.TableColumns);
var newNameColumn = this._generateColumnName(tempArray, startCell - 1);
newTableColumn[l] = new TableColumn();
newTableColumn[l].Name = newNameColumn;
ws.model.getCell(new CellAddress(range2.r1,range2.c1 + l,0)).setValue(newNameColumn);
}
}
else
{
var columnValue = filter.TableColumns[isN].Name;
newTableColumn[l] = new TableColumn();
newTableColumn[l].Name = columnValue;
isN++;
}
}
filter.TableColumns = newTableColumn;
}
};
filter.result = newResult;
filter.Ref = inFilter;
if(val > 0)
this._addButtonAF(newResult);
return filter;
};
},
_changeContentButton: function(array, val, type, inFilter, oldId)
{
......@@ -5446,21 +5447,21 @@ var gUndoInsDelCellsFlag = true;
}
}
}
}
else if(type == 'change')
{
var isChange = false;
for(var j = 0; j < buttons.length; j++)
{
if(oldId == buttons[j].id)
{
buttons[j] = array;
isChange = true;
};
if(!isChange)
buttons[buttons.length] = array;
}
}
else if(type == 'change')
{
var isChange = false;
for(var j = 0; j < buttons.length; j++)
{
if(oldId == buttons[j].id)
{
buttons[j] = array;
isChange = true;
};
if(!isChange)
buttons[buttons.length] = array;
}
};
},
......@@ -6442,9 +6443,9 @@ var gUndoInsDelCellsFlag = true;
}
if(!data)
this._addHistoryObj(oCurFilter, historyitem_AutoFilter_Move, {worksheet: ws, arnTo: arnTo, arnFrom: arnFrom, activeCells: ws.activeRange})
}
this._cleanStyleTable(aWs, arnFrom);
}
this._cleanStyleTable(aWs, arnFrom);
this._reDrawFilters(null, true);
}
......
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