LinkField (对象)
说明
LinkField 关联字段的属性,修改属性之后需要 FieldDescriptor 调用Apply()方法使得修改生效。如果非关联字段,无法设置相关属性
属性
浏览器环境示例
javascript
async function example() {
await instance.ready();
const Application = instance.Application
const fieldDescriptor = await Application.Sheets("数据表").FieldDescriptors("@查找引用")
const linkFieldId = await Application.Sheets("数据表").FieldDescriptors("@单向关联")
const prop = await fieldDescriptor.Lookup
prop.LinkFieldId = linkFieldId
fieldDescriptor.Apply()
}
脚本编辑器 示例
javascript
function main() {
const fieldDescriptor = Sheets("数据表").FieldDescriptors("@查找引用")
const linkFieldId = Sheets("数据表").FieldDescriptors("@单向关联")
const prop = fieldDescriptor.Lookup
prop.LinkFieldId = linkFieldId
fieldDescriptor.Apply()
}
main()