Class FindOptions

Class FindOptions

Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.3.0)

Represents find options.

public class FindOptions

Inheritance

objectFindOptions

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

//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);

'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)

Constructors

FindOptions()

public FindOptions()

Properties

CaseSensitive

Indicates if the searched string is case sensitive.

public bool CaseSensitive { get; set; }

Property Value

bool

ConvertNumericData

Gets or sets a value that indicates whether converting the searched string value to numeric data.

public bool ConvertNumericData { get; set; }

Property Value

bool

IsRangeSet

Indicates whether the searched range is set.

public bool IsRangeSet { get; }

Property Value

bool

LookAtType

Look at type.

public LookAtType LookAtType { get; set; }

Property Value

LookAtType

Remarks

When Aspose.Cells.FindOptions.RegexKey is true and user has specified the exact rule for the regex, for performance consideration this property should be set as Aspose.Cells.LookAtType.EntireContent. Otherwise we will refactor the search key to ensure it can be matched according to the specific type. For example, when the type is Aspose.Cells.LookAtType.Contains(this is the default value for this property), we will add wildcards at the beginning and end of the search key automatically. In this case, the regular expressions will become more complex and the performance will also decrease.

LookInType

Look in type.

public LookInType LookInType { get; set; }

Property Value

LookInType

RegexKey

Indicates whether the searched key is regex. If true the searched key will be taken as regex and parsed. Otherwise the key will be parsed according to the rules in ms excel.

public bool RegexKey { get; set; }

Property Value

bool

Remarks

Even though the search key has been specified as regex, it may be refactored according to specified Aspose.Cells.FindOptions.LookAtType. For example, when the type is Aspose.Cells.LookAtType.Contains(this is the default value for this options), wildcards will be added at the beginning and end of the search key automatically to ensure the match will be checked as “contains”. In this case, the regular expressions will become more complex and the performance will also decrease. So, for performance consideration, if user has specified the exact rule for the regex, then there is no need to use Aspose.Cells.FindOptions.LookAtType as additional constraint and user may set it as Aspose.Cells.LookAtType.EntireContent to get better performance.

SearchBackward

Whether search backward for cells.

public bool SearchBackward { get; set; }

Property Value

bool

SearchOrderByRows

Indicates whether search order by rows or columns.

public bool SearchOrderByRows { get; set; }

Property Value

bool

Style

The format to search for.

public Style Style { get; set; }

Property Value

Style

ValueTypeSensitive

Indicates whether searched cell value type should be same with the searched key.

public bool ValueTypeSensitive { get; set; }

Property Value

bool

Methods

GetRange()

Gets and sets the searched range.

public CellArea GetRange()

Returns

CellArea

Returns the searched range.

SetRange(CellArea)

Sets the searched range.

public void SetRange(CellArea ca)

Parameters

ca CellArea

the searched range.