Excel.LinkedEntityId interface
链接的实体 ID 对象表示一组属性,用于描述用于查找此服务定义值的服务和区域性。
注解
使用方
- Excel.LinkedEntityCellValue: id
- Excel.LinkedEntityCellValueLoadedEventArgs: id
- Excel.LinkedEntityDataDomainCollection: loadLinkedEntityCellValue
- Excel.Workbook: getLinkedEntityCellValue
示例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/20-data-types/data-types-linked-entities.yaml
// Insert a product identity that Excel resolves through the companion load service.
await Excel.run(async (context) => {
const sheet: Excel.Worksheet = context.workbook.worksheets.getItem("Sample");
const productId: Excel.LinkedEntityId = {
entityId: "P1",
domainId: "products",
serviceId: 268436224,
culture: "en-US"
};
const product: Excel.LinkedEntityCellValue = {
type: Excel.CellValueType.linkedEntity,
id: productId,
text: "Chai",
basicType: "Error",
basicValue: "#VALUE!"
};
const productRange: Excel.Range = sheet.getRange("A2");
productRange.valuesAsJson = [[product]];
sheet.getRange("B2:D2").formulas = [["=A2.[Unit Price]", "=A2.Category", "=A2.Supplier"]];
sheet.getRange("B2").numberFormat = [["$0.00"]];
await context.sync();
console.log("Inserted Chai in A2. Excel loads its properties asynchronously; open its card to explore.");
});
属性
| culture | 表示使用了哪种语言区域性来创建此项 |
| domain |
表示特定于用于创建 |
| entity |
表示特定于用于创建 |
| service |
表示 |