Excel.SearchDirection enum

指定搜索方向。

注解

API 集:ExcelApi 1.9

使用方

示例

await Excel.run(async (context) => {
    const sheet = context.workbook.worksheets.getItem("Sample");
    const table = sheet.tables.getItem("ExpensesTable");
    const searchRange = table.getRange();
    
    // Search for cells that exactly match "TODO", ignoring case, and starting from the top-left of the range and going forward.
    const searchCriteria: Excel.SearchCriteria = {
        completeMatch: true,
        matchCase: false,
        searchDirection: Excel.SearchDirection.forward
    };
    const foundRange = searchRange.findOrNullObject("TODO", searchCriteria);
    foundRange.load("address");
    await context.sync();

    if (foundRange.isNullObject) {
        console.log("Text not found");
    } else {
        console.log(foundRange.address);
    }
});

字段

backwards = "Backwards"

按反向顺序搜索。

forward = "Forward"

按向前顺序搜索。