Excel.LinkedEntityDataDomainCreateOptions interface

表示用于创建 LinkedEntityDataDomain 要添加到 的对象 LinkedEntityDataDomainCollection的选项。

注解

API 集:ExcelApi 1.19

Excel web 版不支持此接口。

使用方

示例

// Registers linked entity data domains when the add-in loads.
await Excel.run(async (context) => {
    const productsDomainOptions: Excel.LinkedEntityDataDomainCreateOptions = {
        dataProvider: "Contoso",
        id: "products",
        name: "Products",
        // ID of the custom function called by Excel to resolve or refresh linked entity cell values.
        loadFunctionId: "CONTOSOLOADSERVICE",
        // periodicRefreshInterval is only required when supportedRefreshModes contains "Periodic".
        periodicRefreshInterval: 300,
        // Manual refresh mode is always supported, even if unspecified.
        supportedRefreshModes: [
            Excel.LinkedEntityDataDomainRefreshMode.periodic,
            Excel.LinkedEntityDataDomainRefreshMode.onLoad
        ]
    };

    // Add the data domain to the collection to register it.
    context.workbook.linkedEntityDataDomains.add(productsDomainOptions);
    await context.sync();
});

属性

dataProvider

指定链接实体数据域的数据提供程序的名称。

id

指定链接实体数据域的 ID。 此 ID 对于此 Office 外接程序定义的所有链接实体数据域必须是唯一的。

loadFunctionId

指定自定义函数的 ID,该函数将按需调用以解析或刷新 LinkedEntityCellValue 此链接实体数据域的对象。 有关详细信息,请参阅 自动生成自定义函数的 JSON 元数据:ID

name

指定链接实体数据域的名称。 此名称对于此 Office 外接程序定义的所有链接实体数据域必须是唯一的。

periodicRefreshInterval

指定自动刷新此链接实体数据域对象的频率(以秒 LinkedEntityCellValue 为单位)。 最小有效值为 300。 如果 supportedRefreshModes 数组包含值“Periodic”,则需要此属性。 仅当链接实体数据域的 设置为“定期”时 refreshMode ,此属性才适用。

supportedRefreshModes

指定链接实体数据域支持的所有刷新模式。 默认值为 ["Manual"],即使未指定,也始终支持该值。 在工作簿中保存的刷新模式将作为打开的下一个工作簿上链接实体数据域的默认刷新模式加载。 如果刷新模式未保存在工作簿中,数组中的第一个值将设置为链接实体数据域的默认刷新模式。 如果数组具有值“Periodic”, periodicRefreshInterval 则还必须为链接实体数据域设置 属性。

属性详细信息

dataProvider

指定链接实体数据域的数据提供程序的名称。

dataProvider: string;

属性值

string

注解

API 集:ExcelApi 1.19

Excel web 版不支持此属性。

id

指定链接实体数据域的 ID。 此 ID 对于此 Office 外接程序定义的所有链接实体数据域必须是唯一的。

id: string;

属性值

string

注解

API 集:ExcelApi 1.19

Excel web 版不支持此属性。

loadFunctionId

指定自定义函数的 ID,该函数将按需调用以解析或刷新 LinkedEntityCellValue 此链接实体数据域的对象。 有关详细信息,请参阅 自动生成自定义函数的 JSON 元数据:ID

loadFunctionId: string;

属性值

string

注解

API 集:ExcelApi 1.19

Excel web 版不支持此属性。

name

指定链接实体数据域的名称。 此名称对于此 Office 外接程序定义的所有链接实体数据域必须是唯一的。

name: string;

属性值

string

注解

API 集:ExcelApi 1.19

Excel web 版不支持此属性。

periodicRefreshInterval

指定自动刷新此链接实体数据域对象的频率(以秒 LinkedEntityCellValue 为单位)。 最小有效值为 300。 如果 supportedRefreshModes 数组包含值“Periodic”,则需要此属性。 仅当链接实体数据域的 设置为“定期”时 refreshMode ,此属性才适用。

periodicRefreshInterval?: number;

属性值

number

注解

API 集:ExcelApi 1.19

Excel web 版不支持此属性。

supportedRefreshModes

指定链接实体数据域支持的所有刷新模式。 默认值为 ["Manual"],即使未指定,也始终支持该值。 在工作簿中保存的刷新模式将作为打开的下一个工作簿上链接实体数据域的默认刷新模式加载。 如果刷新模式未保存在工作簿中,数组中的第一个值将设置为链接实体数据域的默认刷新模式。 如果数组具有值“Periodic”, periodicRefreshInterval 则还必须为链接实体数据域设置 属性。

supportedRefreshModes?: Excel.LinkedEntityDataDomainRefreshMode[];

属性值

注解

API 集:ExcelApi 1.19

Excel web 版不支持此属性。