FindOptions
FindOptions class
代表查找选项。
构造函数
特性
方法
例子
[C#]
//实例化工作簿对象
Workbook workbook = new Workbook("book1.xls");
//获取单元格集合
Cells cells = workbook.Worksheets[0].Cells;
//实例化 FindOptions 对象
FindOptions findOptions = new FindOptions();
//创建一个单元格区域
CellArea ca = new CellArea();
ca.StartRow = 8;
ca.StartColumn = 2;
ca.EndRow = 17;
ca.EndColumn = 13;
//为查找选项设置单元格区域
findOptions.SetRange(ca);
//设置搜索属性
findOptions.SearchBackward = false;
findOptions.SeachOrderByRows = true;
findOptions.LookInType = LookInType.Values;
//查找值为0的单元格
Cell cell = cells.Find(0, null, findOptions);
[VB.NET]
'实例化工作簿对象
Dim workbook As New Workbook("book1.xls")
'获取细胞集合
Dim cells As Cells = workbook.Worksheets(0).Cells
'实例化 FindOptions 对象
Dim findOptions As New FindOptions()
'创建单元格区域
Dim ca As New CellArea()
ca.StartRow = 8
ca.StartColumn = 2
ca.EndRow = 17
ca.EndColumn = 13
'为查找选项设置单元格区域
findOptions.SetRange(ca)
'设置搜索属性
findOptions.SearchBackward = True
findOptions.SeachOrderByRows = True
findOptions.LookInType = LookInType.Values
'查找值为 0 的单元格
Dim cell As Cell = cells.Find(0, Nothing, findOptions)
也可以看看