Free Support Forum - aspose.com

Javascript onCellUpdate problem

Hi,

Im using onCellUpdate to capture client-side events.

The problem occours when i copy-paste a column/row of values. The event is called but the functions getActiveRow() and getActiveColumn() reffer always to the first cell (the cell that has the focus).

Here is my code:

function onCellUpdate(cell){

if(document.getElementById ("changedCells") != null)

document.getElementById ("changedCells").value +=this.getActiveColumn() +"&"+this.getActiveRow() +"&"+ this.getCellValueByCell(cell)+";";

}

Thank you,

Paulo

Hi,

Well, getActiveRow() and getActiveColumn() functions return the cell indexes which got focus. When you copy / paste some cells to some location, you draw or highlight the area where you will paste the cells, the first starting cell in your destination cell range will be got active. I think this logic is same with MS Excel.

Thank you.

If i select 2 rows/ 1 column in excel and copy-paste to aspose selecting 2 rows/ 1 column, im getting the same row/column number....thats not right...

There are any function that return the active cell corresponding to the cell that have the value (not the cell that has the focus)? Or there are any other events that i can use?

Tks,

Paulo

Hi,

You may use getCellRow and getCellColumn methods. Here is the usage:

function onCellUpdate(cell){

if(document.getElementById ("changedCells") != null)

document.getElementById ("changedCells").value +=this.getCellColumn(cell) +"&"+this.getCellRow(cell) +"&"+ this.getCellValueByCell(cell)+";";

}

Thanks