Skip to content Skip to sidebar Skip to footer

Javascript Api For Office: How To Get Currently Selected Cell Identifier?

I've come to the conclusion that this functionality is not currently available in the JavaScript API for Office v1.1, but thought I'd just make sure here first. I would like to get

Solution 1:

One hacky way you might be able to do it is as follows:

  1. Add a binding to the region of the sheet you care about
  2. Add a change handler to that binding
  3. Call getSelectedDataAsync and store the value
  4. Call setSelectedDataAsync with some arbitrary string. This will trigger your change handler.
  5. In the change handler's callback, get the data for the binding
  6. Search for your string and calculate the identifier from its index
  7. Restore the data

Hope that helps, might be a little fragile though.

edit: It looks like the BindingSelectionChanged callback gets an event with position information (startRow, startColumn, rowCount, columnCount) so no need for the hack above :)

Post a Comment for "Javascript Api For Office: How To Get Currently Selected Cell Identifier?"