Criteria.Field(属性)
说明
筛选项字段值:
值选项 | 描述 |
---|---|
columnNumber | 列号,从1开始 |
fieldId | 字段id |
浏览器环境示例
javascript
async function example() {
// 添加一个筛选条件
await instance.ready();
const app = instance.Application;
const filters = await app.Sheets(1).Views(1).Filters;
const criteria = app.Criteria(1, 'Equals', ['1'])
const filter = await filters.Add(criteria);
// 读取添加的筛选条件规则
const criteria = await app.Sheets(1).Views(1).Filters(1).Criteria
console.log(criteria.Op) // "Equals"
console.log(criteria.Field) // 1
console.log(criteria.Value) // [{type: 'Text', value: '1'}]
}
脚本编辑器示例
javascript
function main() {
// 添加一个筛选条件
const filters = Application.Sheets(1).Views(1).Filters;
const criteria = Application.Criteria(1, 'Equals', ['1'])
const filter = filters.Add(criteria);
// 读取添加的筛选条件规则
const criteria = Application.Sheets(1).Views(1).Filters(1).Criteria
console.log(criteria.Op) // "Equals"
console.log(criteria.Field) // 1
console.log(criteria.Value) // [{type: 'Text', value: '1'}]
}
main()