How to access changed data using office.js

I am developing software Excelas an application for Office using office.js.

In some part, I connect to a table in excel to check if its data has changed using the following code:

myBinding.addHandlerAsync(Office.EventType.BindingDataChanged, onBindingDataChanged);


function onBindingDataChanged(eventArgs) {
    // eventArgs has just the binding info.
    // I want to have selected cell row and column, and old and new data.
}

Unfortunately, there is eventArgsnot enough information to detect changes. It is worth mentioning that for Office.EventType.Binding Selection Changed, there is a lot of useful information, for example startRow, startColumn, ....

So my question is: How can I access this information:

  • Modified row
  • Modified Column
  • Old data
  • New data
+4
1

excel. . .

var oldData = null;

function onBindingDataChanged(eventArgs) {
    var id = eventArgs.binding.id;
    Office.select('bindings#'+id).getDataAsync(handleNewData);
}

function handleNewData(asyncResult) {
    var newData = asyncResult.value;

    if (oldData != null) {
        // detect changes here
    }

    oldData = newData;
);
+1

Source: https://habr.com/ru/post/1584937/


All Articles