FindOptions

FindOptions class

Represents find options.

public class FindOptions

Constructors

Name Description
FindOptions() The default constructor.

Properties

Name Description
CaseSensitive { get; set; } Indicates if the searched string is case sensitive.
ConvertNumericData { get; set; } Gets or sets a value that indicates whether converting the searched string value to numeric data.
IsCaseSensitive { get; set; } Indicates if the searched string is case sensitive.
IsRangeSet { get; } Indicates whether the searched range is set.
LookAtType { get; set; } Look at type.
LookInType { get; set; } Look in type.
RegexKey { get; set; } Indicates whether the searched key is regex. If true then the searched key will be taken as regex.
SeachOrderByRows { get; set; } Indicates whether search order by rows or columns.
SearchBackward { get; set; } Whether search backward for cells.
SearchNext { get; set; } Search order. True: search next. False: search previous.
Style { get; set; } The format to search for.
ValueTypeSensitive { get; set; } Indicates whether searched cell value type should be same with the searched key.

Methods

Name Description
GetRange() Gets and sets the searched range.
SetRange(CellArea) Sets the searched range.

Examples


[C#]

//Instantiate the workbook object
Workbook workbook = new Workbook("book1.xls");

//Get Cells collection 
Cells cells = workbook.Worksheets[0].Cells;

//Instantiate FindOptions Object
FindOptions findOptions = new FindOptions();

//Create a Cells Area
CellArea ca = new CellArea();
ca.StartRow = 8;
ca.StartColumn = 2;
ca.EndRow = 17;
ca.EndColumn = 13;

//Set cells area for find options
findOptions.SetRange(ca);

//Set searching properties
findOptions.SearchBackward = false;

findOptions.SeachOrderByRows = true;

findOptions.LookInType = LookInType.Values;

//Find the cell with 0 value
Cell cell = cells.Find(0, null, findOptions);

[VB.NET]

'Instantiate the workbook object
Dim workbook As New Workbook("book1.xls")

'Get Cells collection 
Dim cells As Cells = workbook.Worksheets(0).Cells

'Instantiate FindOptions Object
Dim findOptions As New FindOptions()

'Create a Cells Area
Dim ca As New CellArea()
ca.StartRow = 8
ca.StartColumn = 2
ca.EndRow = 17
ca.EndColumn = 13

'Set cells area for find options
findOptions.SetRange(ca)

'Set searching properties
findOptions.SearchBackward = True

findOptions.SeachOrderByRows = True

findOptions.LookInType = LookInType.Values

'Find the cell with 0 value
Dim cell As Cell = cells.Find(0, Nothing, findOptions)

See Also