Class FindOptions

FindOptions class

Represents find options.

public class FindOptions

Constructors

NameDescription
FindOptions()The default constructor.

Properties

NameDescription
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; }(Obsolete.) 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 the searched key will be taken as regex and parsed. Otherwise the key will be parsed according to the rules in ms excel.
SeachOrderByRows { get; set; }(Obsolete.) Indicates whether search order by rows or columns.
SearchBackward { get; set; }Whether search backward for cells.
SearchNext { get; set; }(Obsolete.) Search order. True: search next. False: search previous.
SearchOrderByRows { get; set; }Indicates whether search order by rows or columns.
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

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

Examples

namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using System;

    public class FindOptionsDemo
    {
        public static void FindOptionsExample()
        {
            // Instantiate the workbook object
            Workbook workbook = new Workbook("FindOptionsExample_original.xlsx");

            // 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 = 0;
            ca.StartColumn = 0;
            ca.EndRow = 5;
            ca.EndColumn = 5;

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

            if (cell != null)
            {
                Console.WriteLine("Cell found at: " + cell.Name);
            }
            else
            {
                Console.WriteLine("Cell not found.");
            }
        }
    }
}

See Also