Office.BindingSelectionChangedEventArgs interface

Provides information about the binding that raised the SelectionChanged event.

Properties

binding

Gets an Office.Binding object that represents the binding that raised the SelectionChanged event.

columnCount

Gets the number of columns 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 Office.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.

rowCount

Gets 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 Office.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.

startColumn

The zero-based index of the first column of the selection counting from the leftmost column in the binding.

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

For Word, this property will work only for bindings of Office.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.

startRow

The zero-based index of the first row of the selection counting from the first row in the binding.

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

For Word, this property will work only for bindings of Office.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.

type

Gets an Office.EventType enumeration value that identifies the kind of event that was raised.

Property Details

binding

Gets an Office.Binding object that represents the binding that raised the SelectionChanged event.

binding: Binding;

Property Value

Binding

columnCount

Gets the number of columns 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 Office.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.

columnCount: number;

Property Value

number

Examples

// 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; 
}

rowCount

Gets 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 Office.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.

rowCount: number;

Property Value

number

Examples

// 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; 
}

startColumn

The zero-based index of the first column of the selection counting from the leftmost column in the binding.

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

For Word, this property will work only for bindings of Office.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.

startColumn: number;

Property Value

number

Examples

// 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; 
}

startRow

The zero-based index of the first row of the selection counting from the first row in the binding.

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

For Word, this property will work only for bindings of Office.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.

startRow: number;

Property Value

number

Examples

// 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; 
}

type

Gets an Office.EventType enumeration value that identifies the kind of event that was raised.

type: EventType;

Property Value

EventType