Excel.BindingDataChangedEventArgs interface

データ変更イベントを発生させたバインドに関する情報を提供します。

注釈

API セット: ExcelApi 1.2

使用元

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/30-events/data-changed.yaml

async function registerDataChangedHandler() {
    await Excel.run(async (context) => {
        const sheet = context.workbook.worksheets.getItem("Sample");    
        const salesTable = sheet.tables.getItem("SalesTable");
        const salesByQuarterBinding = context.workbook.bindings.add(salesTable.getRange(), "Table", "SalesByQuarter");
        salesByQuarterBinding.onDataChanged.add(onSalesDataChanged);

        console.log("The data changed handler is registered.");

        await context.sync();
    });
}

async function onSalesDataChanged(eventArgs: Excel.BindingDataChangedEventArgs) {
    await Excel.run(async (context) => {
        console.log("Data was changed with binding " + eventArgs.binding.id);
        
        // Get the name of the table that's changed.
        const table: Excel.Table = context.workbook.bindings.getItem(eventArgs.binding.id).getTable();
        table.load("name");

        await context.sync();
        console.log("Name of the changed table: " + table.name);
    });
} 

プロパティ

binding

イベントを発生させた Binding オブジェクトの ID を含む一時的な Binding オブジェクトを取得します。 バインドを取得するには、その ID を BindingCollection.getItem(id) と共に使用します。

プロパティの詳細

binding

イベントを発生させた Binding オブジェクトの ID を含む一時的な Binding オブジェクトを取得します。 バインドを取得するには、その ID を BindingCollection.getItem(id) と共に使用します。

binding: Excel.Binding;

プロパティ値

注釈

API セット: ExcelApi 1.2