FieldDescriptors (对象)
说明
字段描述的集合,保存了文档所有的字段的信息
方法
属性
事件
浏览器环境示例
javascript
async function example() {
await instance.ready();
const app = instance.Application;
const fieldDescriptors = await app.Sheets(1).FieldDescriptors
}
脚本编辑器 示例
javascript
function main(){
const sheet = Application.Sheets(1)
const sheet2 = Application.Sheets(2)
const lookupFieldId = sheet2.FieldId("文本")
// 创建关联字段到sheet2
const linkField = Application.FieldDescriptor(Enum.DbSheetFieldType.OneWayLink, "关联字段到sheet2")
linkField.LinkSheet = sheet2.StId
linkField.IsAutoLink = false
/*
const linkGroups = Application.AutoLinkGroups()
const group = linkGroups.Add()
const conditions = group.Conditions
conditions.Add(lookupFieldId, [lookupFieldId], Enum.DbAutolinkCondType.Field, Enum.DbAutolinkCondType.DbFilterCriteriaOpType.Equals, )
linkField.AutoLinkGroups = linkGroups
*/
sheet.FieldDescriptors.AddField(linkField)
// 创建引用字段
const descriptor = Application.FieldDescriptor(Enum.DbSheetFieldType.Lookup, "引用关联字段到sheet2")
descriptor.LinkFieldId = sheet.FieldId("关联")
descriptor.LookupFieldId = lookupFieldId
sheet.FieldDescriptors.AddField(descriptor, 6)
}
main()