Office.BindingSelectionChangedEventArgs interface

SelectionChanged イベントが発生したバインドに関する情報を提供します。

プロパティ

binding

SelectionChanged イベントを発生させたバインドを表す Office.Binding オブジェクトを取得します。

columnCount

選択されている列の数を取得します。 セルが 1 つだけ選択されている場合は 1 が返されます。

ユーザーの選択範囲が連続していない場合は、バインド内で最後に連続している選択範囲の数が返されます。

Word の場合、このプロパティは Office.BindingType "table" のバインドに対してのみ機能します。 バインドが "matrix" 型の場合は、null が返されます。 また、テーブルにマージされたセルが含まれている場合、このプロパティが正しく機能するためにはテーブルの構造が一様である必要があるため、呼び出しは失敗します。

rowCount

選択されている行の数を取得します。 セルが 1 つだけ選択されている場合は 1 が返されます。

ユーザーの選択範囲が連続していない場合は、バインド内で最後に連続している選択範囲の数が返されます。

Word の場合、このプロパティは Office.BindingType "table" のバインドに対してのみ機能します。 バインドが "matrix" 型の場合は、null が返されます。 また、テーブルにマージされたセルが含まれている場合、このプロパティが正しく機能するためにはテーブルの構造が一様である必要があるため、呼び出しは失敗します。

startColumn

選択範囲の先頭列の (0 から始まる) インデックス。このインデックスは、バインド内の左端の列からカウントされます。

ユーザーの選択範囲が連続していない場合は、バインド内で最後に連続している選択範囲の座標が返されます。

Word の場合、このプロパティは Office.BindingType "table" のバインドに対してのみ機能します。 バインドが "matrix" 型の場合は、null が返されます。 また、テーブルにマージされたセルが含まれている場合、このプロパティが正しく機能するためにはテーブルの構造が一様である必要があるため、呼び出しは失敗します。

startRow

選択範囲の先頭行のインデックス (0 から始まる)。インデックスは、バインド内の先頭行からカウントされます。

ユーザーの選択範囲が連続していない場合は、バインド内で最後に連続している選択範囲の座標が返されます。

Word の場合、このプロパティは Office.BindingType "table" のバインドに対してのみ機能します。 バインドが "matrix" 型の場合は、null が返されます。 また、テーブルにマージされたセルが含まれている場合、このプロパティが正しく機能するためにはテーブルの構造が一様である必要があるため、呼び出しは失敗します。

type

発生したイベントの種類を識別する Office.EventType 列挙値を取得します。

プロパティの詳細

binding

SelectionChanged イベントを発生させたバインドを表す Office.Binding オブジェクトを取得します。

binding: Binding;

プロパティ値

columnCount

選択されている列の数を取得します。 セルが 1 つだけ選択されている場合は 1 が返されます。

ユーザーの選択範囲が連続していない場合は、バインド内で最後に連続している選択範囲の数が返されます。

Word の場合、このプロパティは Office.BindingType "table" のバインドに対してのみ機能します。 バインドが "matrix" 型の場合は、null が返されます。 また、テーブルにマージされたセルが含まれている場合、このプロパティが正しく機能するためにはテーブルの構造が一様である必要があるため、呼び出しは失敗します。

columnCount: number;

プロパティ値

number

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

選択されている行の数を取得します。 セルが 1 つだけ選択されている場合は 1 が返されます。

ユーザーの選択範囲が連続していない場合は、バインド内で最後に連続している選択範囲の数が返されます。

Word の場合、このプロパティは Office.BindingType "table" のバインドに対してのみ機能します。 バインドが "matrix" 型の場合は、null が返されます。 また、テーブルにマージされたセルが含まれている場合、このプロパティが正しく機能するためにはテーブルの構造が一様である必要があるため、呼び出しは失敗します。

rowCount: number;

プロパティ値

number

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

選択範囲の先頭列の (0 から始まる) インデックス。このインデックスは、バインド内の左端の列からカウントされます。

ユーザーの選択範囲が連続していない場合は、バインド内で最後に連続している選択範囲の座標が返されます。

Word の場合、このプロパティは Office.BindingType "table" のバインドに対してのみ機能します。 バインドが "matrix" 型の場合は、null が返されます。 また、テーブルにマージされたセルが含まれている場合、このプロパティが正しく機能するためにはテーブルの構造が一様である必要があるため、呼び出しは失敗します。

startColumn: number;

プロパティ値

number

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

選択範囲の先頭行のインデックス (0 から始まる)。インデックスは、バインド内の先頭行からカウントされます。

ユーザーの選択範囲が連続していない場合は、バインド内で最後に連続している選択範囲の座標が返されます。

Word の場合、このプロパティは Office.BindingType "table" のバインドに対してのみ機能します。 バインドが "matrix" 型の場合は、null が返されます。 また、テーブルにマージされたセルが含まれている場合、このプロパティが正しく機能するためにはテーブルの構造が一様である必要があるため、呼び出しは失敗します。

startRow: number;

プロパティ値

number

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

発生したイベントの種類を識別する Office.EventType 列挙値を取得します。

type: EventType;

プロパティ値