BindingSelectionChangedEventArgs.rowCount property (JavaScript API for Office v1.1)

JavaScript API for Office v1.1

Gets the number of rows selected.

Last modified: February 19, 2014

var rwCount = eventArgsObj.rowCount;

The number of rows selected. If a single cell is selected returns 1.

If the user makes a non-contiguous selection, the count for the last contiguous selection within the binding is returned.

For Word, this property will work only for bindings of BindingType "table". If the binding is of type "matrix", null is returned. Also, the call will fail if the table contains merged cells, because the structure of the table must be uniform for this property to work correctly.

In version 1.1 of Office.js, you can now add and remove event handlers for the SelectionChanged event in content apps for Access.

The following example adds an event handler for the SelectionChanged event to the binding with an id of myTable. When the user changes the selection, the handler displays the coordinates of the first cell in the selection, and the number of row and columns selected.

function addSelectionHandler() {
    Office.context.document.bindings.getByIdAsync("myTable", function (result) {
        result.value.addHandlerAsync("bindingSelectionChanged", myHandler);

// Display selection start coordinates and row/column count.
function myHandler(bArgs) {
    write("Selection start row/col: " + bArgs.startRow + "," + bArgs.startColumn);
    write("Selection row count: " + bArgs.rowCount);
    write("Selection col count: " + bArgs.columnCount);
// Function that writes to a div with id='message' on the page.
function write(message){
    document.getElementById('message').innerText += message; 

App types

Content apps, Task pane apps

Supported clients

Access app for SharePoint, Excel 2013, Excel Online, Word 2013





© 2014 Microsoft