Skip to main content
Row

SearchOptions.SearchIn Property

Specifies whether to search cell values only or extend search to include underlying formulas.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v24.2.Core.dll

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

public SearchIn SearchIn { get; set; }

Property Value

Type Description
SearchIn

One of the SearchIn enumeration values indicating what to examine in each cell.

Available values:

Name Description
Formulas

Searches cell values and formula expressions only, excluding the calculated results.

ValuesAndFormulas

Searches both cell values (including values calculated from formulas) and underlying formulas.

Values

Searches cell values only (including values calculated from formulas).

Remarks

For more information about how to perform a search in the document, see Find and Replace.

Example

The example below demonstrates how to perform a search with the specified options in the active worksheet and highlight all matching cells.

View Example

workbook.LoadDocument("Documents\ExpenseReport.xlsx")
workbook.Calculate()
Dim worksheet As Worksheet = workbook.Worksheets(0)

' Specify the search term.
Dim searchString As String = Date.Today.ToString("d")

' Specify search options.
Dim options As New SearchOptions()
options.SearchBy = SearchBy.Columns
options.SearchIn = SearchIn.Values
options.MatchEntireCellContents = True

' Find all cells containing today's date and paint them light-green.
Dim searchResult As IEnumerable(Of Cell) = worksheet.Search(searchString, options)
For Each cell As Cell In searchResult
    cell.Fill.BackgroundColor = Color.LightGreen
Next cell

The following code snippets (auto-collected from DevExpress Examples) contain references to the SearchIn property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also