OptionalaxisSpecifies the direction of the search.
OptionaldisableIf true, the search will not wrap around to the beginning of the range after reaching
the end. By default, the search will wrap.
OptionalfieldsAn enum of the types of values to search within each field.
OptionalfromThe starting point for the search. If not provided, the search will start
from the top left corner of the range, or from the bottom right if reverse is true.
OptionalmatchIf true then the text search is case sensitive.
OptionalmatchProvides custom logic for matching values during the find operation.
The current cell value being checked against the criteria.
A default implementation of the find operation's matching logic. You can call this in your custom logic to fall back to the default behavior if needed.
The criteria that the find operation is trying to match. This is typically defined by the user and passed to the find method.
Contextual information about the cell, such as its address or value-related utilities. See ICell.IteratorContext for more details.
A boolean indicating if the value satisfies the criteria.
If matchCustom is provided, this function will override the default matching logic for the find operation.
Use it to implement custom search rules, while the matchDefault can be used as a fallback for standard criteria.
Example usage:
const options = {
matchCustom: (value, matchDefault, criteria, context) => {
// Custom match logic
if (typeof value === 'string' && value.includes('important')) {
return true;
}
// Fallback to default match
return matchDefault();
}
};
OptionalmatchIf true the text must match the entire cell to be true.
OptionalreverseIf true, the search will proceed in reverse order.
The text to search for.
OptionaluseDetermines whether the find operation should treat the search text as a regular expression (RegEx).
When true, the search text will be interpreted as a regular expression (RegEx), allowing for
advanced pattern matching.
If false, the find operation will not use RegEx but will support three wildcard characters
for flexible searching:
? (question mark): Matches any single character.* (asterisk): Matches any number of characters, including zero.~ (tilde followed by ?, *, or ~): Escapes the wildcard characters (? or *) to allow
searching for these literal characters in the text.Example usage:
// Search for text matching a RegEx pattern
const results: Iterator<ICell> = range.find({ text: "\\d+", useRegex: true }); // Finds numeric values
// Search for text using wildcards
const results: Iterator<ICell> = range.find({ text: "abc*", useRegex: false }); // Finds text starting with "abc"
Options for ICellRange.find.