FindOptions

FindOptions class

Represents find options.

class FindOptions;

Example

const { Workbook, FindOptions, CellArea, LookInType } = AsposeCells;

//Instantiate the workbook object
var workbook = new Workbook(data);
//Get Cells collection 
var cells = workbook.worksheets.get(0).cells;
//Instantiate FindOptions Object
var findOptions = new FindOptions();
//Create a Cells Area
var 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.searchOrderByRows = true;
findOptions.lookInType = LookInType.Values;
//Find the cell with 0 value
var cell = cells.find(0, null, findOptions);

Constructors

NameDescription
constructor()Default Constructor.

Properties

PropertyTypeDescription
caseSensitivebooleanIndicates if the searched string is case sensitive.
lookAtTypeLookAtTypeLook at type.
isRangeSetbooleanReadonly. Indicates whether the searched range is set.
searchBackwardbooleanWhether search backward for cells.
searchOrderByRowsbooleanIndicates whether search order by rows or columns.
lookInTypeLookInTypeLook in type.
regexKeybooleanIndicates 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.
valueTypeSensitivebooleanIndicates whether searched cell value type should be same with the searched key.
styleStyleThe format to search for.
convertNumericDatabooleanGets or sets a value that indicates whether converting the searched string value to numeric data.

Methods

MethodDescription
getRange()Gets and sets the searched range.
setRange(CellArea)Sets the searched range.

constructor()

Default Constructor.

constructor();

caseSensitive

Indicates if the searched string is case sensitive.

caseSensitive : boolean;

lookAtType

Look at type.

lookAtType : LookAtType;

Remarks

When RegexKey is true and user has specified the exact rule for the regex, for performance consideration this property should be set as 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 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.

isRangeSet

Readonly. Indicates whether the searched range is set.

isRangeSet : boolean;

searchBackward

Whether search backward for cells.

searchBackward : boolean;

searchOrderByRows

Indicates whether search order by rows or columns.

searchOrderByRows : boolean;

lookInType

Look in type.

lookInType : 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.

regexKey : boolean;

Remarks

Even though the search key has been specified as regex, it may be refactored according to specified LookAtType. For example, when the type is 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 LookAtType as additional constraint and user may set it as LookAtType.EntireContent to get better performance.

valueTypeSensitive

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

valueTypeSensitive : boolean;

style

The format to search for.

style : Style;

convertNumericData

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

convertNumericData : boolean;

getRange()

Gets and sets the searched range.

getRange() : CellArea;

Returns

Returns the searched range.

setRange(CellArea)

Sets the searched range.

setRange(ca: CellArea) : void;

Parameters:

ParameterTypeDescription
caCellAreathe searched range.