Excel.ClearApplyTo enum

注解

[ API 集:ExcelApi 1.1 ]

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/42-range/range-hyperlink.yaml

await Excel.run(async (context) => {
    const sheet = context.workbook.worksheets.getItem("Orders");

    const productsRange = sheet.getRange("A3:A11");
    productsRange.load("values");

    await context.sync();

    // Clear all hyperlinks.
    for (let i = 0; i < productsRange.values.length; i++) {
        let cellRange = productsRange.getCell(i, 0);

        // Clear the hyperlink.
        // This removes the hyperlink but does not update text format.
        cellRange.clear(Excel.ClearApplyTo.hyperlinks);

        // Update text format.
        cellRange.format.font.underline = Excel.RangeUnderlineStyle.none;
        cellRange.format.font.color = "#000000";
    }

    await context.sync();
});

字段

all = "All"
contents = "Contents"

清除区域的内容。

formats = "Formats"

清除区域的所有格式设置。

hyperlinks = "Hyperlinks"

清除所有超链接,但保留所有内容和格式不变。

removeHyperlinks = "RemoveHyperlinks"

删除单元格的超链接和格式,但保留内容、条件格式和数据验证不变。