Excel.EntityCellValue interface
表示一组没有架构或已定义结构的属性。
注解
示例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/20-data-types/data-types-function-references.yaml
// Attach a reference to a JavaScript custom function as a method on a math entity.
await Excel.run(async (context) => {
const sheet: Excel.Worksheet = context.workbook.worksheets.getItem("Sample");
const entityRange: Excel.Range = sheet.getRange("A2");
const referenceType: Excel.FunctionCellValueType = Excel.FunctionCellValueType.javaScriptReference;
const customFunctionReference: Excel.JavaScriptCustomFunctionReferenceCellValue = {
type: Excel.CellValueType.function,
functionType: referenceType,
namespace: "CONTOSO",
id: "GET27"
};
// The namespace and ID identify a function; this value doesn't register its implementation.
const mathEntity: Excel.EntityCellValue = {
type: Excel.CellValueType.entity,
text: "Math value",
properties: {
Value: {
type: Excel.CellValueType.double,
basicValue: 10
},
Get27: customFunctionReference
}
};
entityRange.valuesAsJson = [[mathEntity]];
entityRange.format.autofitColumns();
await context.sync();
console.log("Created the Math value entity in Sample!A2. Read the reference to inspect its metadata.");
});
属性
| basic |
表示对于具有此值的单元格将返回 |
| basic |
表示对于具有此值的单元格将返回 |
| layouts | 表示此实体视图的布局信息。 |
| properties | 表示此实体的属性及其元数据。 |
| provider | 表示描述在此 |
| referenced |
表示在 中引用 |
| text | 表示呈现具有此值的单元格时显示的文本。 |
| type | 表示此单元格值的类型。 |
属性详细信息
basicType
表示对于具有此值的单元格将返回 Range.valueTypes 的值。
basicType?: RangeValueType.error | "Error";
属性值
error | "Error"
注解
basicValue
表示对于具有此值的单元格将返回 Range.values 的值。 通过 valuesAsJson 属性访问时,此字符串值与 en-US 区域设置一致。 通过 valuesAsJsonLocal 属性访问时,此字符串值与用户的显示区域设置一致。
basicValue?: "#VALUE!" | string;
属性值
"#VALUE!" | string
注解
layouts
properties
表示此实体的属性及其元数据。
properties?: {
[key: string]: EntityPropertyType;
};
属性值
{ [key: string]: Excel.EntityPropertyType; }
注解
provider
表示描述在此 EntityCellValue. 此信息可用于实体卡中的品牌打造。
provider?: CellValueProviderAttributes;
属性值
注解
referencedValues
表示在 中引用 EntityCellValue.properties的单元格值。
referencedValues?: ReferencedValue[];
属性值
注解
text
type
表示此单元格值的类型。
type: CellValueType.entity | ReferenceValueType.entity | "Entity";