officefileapi-devexpress-dot-spreadsheet-204a13a3.md
Contains options affecting search in a document.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
public class SearchOptions
Public Class SearchOptions
Use the IWorkbook.Search, Worksheet.Search or CellRange.Search method with a SearchOptions instance passed as a parameter to perform a search with the required settings.
The following code snippet searches for cells that contain today’s date. The matching cells are highlighted in green:
using DevExpress.Spreadsheet;
// ...
// Specify the search term.
string searchString = DateTime.Today.ToString("d");
// Specify search options.
SearchOptions options = new SearchOptions();
options.SearchBy = SearchBy.Columns;
options.SearchIn = SearchIn.Values;
options.MatchEntireCellContents = true;
// Find and highlight all cells that contain today's date.
IEnumerable<Cell> searchResult = worksheet.Search(searchString, options);
foreach (Cell cell in searchResult)
cell.Fill.BackgroundColor = Color.LightGreen;
Imports DevExpress.Spreadsheet
' ...
' 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 and highlight all cells that contain today's date.
Dim searchResult As IEnumerable(Of Cell) = worksheet.Search(searchString, options)
For Each cell As Cell In searchResult
cell.Fill.BackgroundColor = Color.LightGreen
Next cell
Object SearchOptions
See Also