Excel.LinkedEntityDataDomainRefreshMode enum

表示对象LinkedEntityDataDomain的刷新模式设置LinkedEntityCellValue。

注解

API 集:ExcelApi 1.19

Excel web 版不支持此枚举。

使用方

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/20-data-types/data-types-linked-entities.yaml

// Register the product, category, and supplier data sources with Excel.
await Excel.run(async (context) => {
    const domains: Excel.LinkedEntityDataDomainCollection = context.workbook.linkedEntityDataDomains;
    const refreshModes: Excel.LinkedEntityDataDomainRefreshMode[] = [
        Excel.LinkedEntityDataDomainRefreshMode.manual,
        Excel.LinkedEntityDataDomainRefreshMode.onLoad,
        Excel.LinkedEntityDataDomainRefreshMode.periodic
    ];
    // Script Lab prefixes the function ID with the companion sample's name, without spaces.
    const loadFunctionId = "LINKEDENTITYLOADSERVICE.CONTOSOLOADSERVICE";
    const options: Excel.LinkedEntityDataDomainCreateOptions[] = [
        {
            dataProvider: "Contoso",
            id: "products",
            name: "Products",
            loadFunctionId,
            periodicRefreshInterval: 300,
            supportedRefreshModes: refreshModes
        },
        {
            dataProvider: "Contoso",
            id: "categories",
            name: "Categories",
            loadFunctionId,
            periodicRefreshInterval: 300,
            supportedRefreshModes: refreshModes
        },
        {
            dataProvider: "Contoso",
            id: "suppliers",
            name: "Suppliers",
            loadFunctionId
        }
    ];

    // Replace only this sample's domains so registration is repeatable.
    const existingDomains: Excel.LinkedEntityDataDomain[] = options.map((options) =>
        domains.getItemOrNullObject(options.id)
    );
    await context.sync();
    existingDomains.forEach((domain) => {
        if (!domain.isNullObject) {
            domain.delete();
        }
    });
    options.forEach((options) => domains.add(options));
    await context.sync();
    console.log("Registered Products, Categories, and Suppliers. Manual refresh is the default.");
});

字段

manual = "Manual"

由用户手动刷新。 刷新不会自动触发。

Excel web 版不支持此字段。

onLoad = "OnLoad"

工作簿加载时刷新,适用于服务数据提供程序(如必应或 Power BI)定义的链接实体数据域。 加载加载项时刷新,适用于 Office 加载项定义的链接实体数据域。

Excel web 版不支持此字段。

periodic = "Periodic"

根据由 指定的频率(以秒 periodicRefreshInterval为单位)自动刷新。 对于由服务数据提供程序(如必应或 Power BI)定义的链接实体数据域,此值也会在每次打开工作簿时启动刷新。 对于 Office 加载项定义的链接实体数据域,此值也会在每次加载加载项时启动刷新。

Excel web 版不支持此字段。

unknown = "Unknown"

刷新模式未知或不受支持。

Excel web 版不支持此字段。