通过


Excel.WorksheetCalculatedEventArgs interface

提供有关引发计算事件的工作表的信息。

注解

[ API 集:ExcelApi 1.8 ]

示例

async function registerOnCalculatedHandler() {
    await Excel.run(async (context) => {
        let sheet = context.workbook.worksheets.getItem("Sample");
        sheet.onCalculated.add(onCalculated);
        await context.sync();
    });
}

async function onCalculated(event: Excel.WorksheetCalculatedEventArgs) {
    await Excel.run(async (context) => {
        // `event.address` returns the address of the range that completed calculation.
        // If multiple ranges completed calculation, the string is a comma-separated list of those range addresses.
        console.log(`The Range ${event.address} has recalculated.`);
    });
}

属性

address

完成计算的范围的地址。 如果多个区域已完成计算,则字符串是这些范围地址的逗号分隔列表。

type

获取事件的类型。 有关详细信息,请参阅 Excel.EventType

worksheetId

获取进行计算的工作表的 ID。

属性详细信息

address

完成计算的范围的地址。 如果多个区域已完成计算,则字符串是这些范围地址的逗号分隔列表。

address: string;

属性值

string

注解

[ API 集:ExcelApi 1.11 ]

type

获取事件的类型。 有关详细信息,请参阅 Excel.EventType

type: "WorksheetCalculated";

属性值

"WorksheetCalculated"

注解

[ API 集:ExcelApi 1.8 ]

worksheetId

获取进行计算的工作表的 ID。

worksheetId: string;

属性值

string

注解

[ API 集:ExcelApi 1.8 ]