[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Collapse]Spreadsheet
    Product Structure
   [Expand]Getting Started
   [Expand]Spreadsheet Document
    Supported Formats
   [Expand]Cell Basics
   [Expand]Formulas
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
   [Expand]Pivot Table Overview
   [Expand]Charting Overview
    Shapes
    Printing
    Protection
    Find and Replace
   [Expand]Mail Merge
   [Expand]Visual Elements
    Services
    Themes and Templates
   [Expand]Shortcuts
   [Expand]Examples
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Find and Replace

The SpreadsheetControl allows you to search for specific data in a document. You can perform a search using the SpreadsheetControl's user interface, or directly in code using the corresponding Search method overloads.

Expanded Search Using the Find and Replace Dialog

You can find data in the current worksheet using the Find and Replace feature of the SpreadsheetControl. To perform a search, on the Home tab, in the Editing group, click the Find & Select button. The button's drop-down menu will be displayed.

Next, do one of the following.

  • Click Find in the Find & Select drop-down menu (or press CTRL+F) to perform a search in the active worksheet. The Find and Replace dialog (with the Find tab activated) will be invoked.

    In the Find what field, enter the text or number you wish to find, and click the Find Next button to start the search. To define the direction of the search, in the Search field, select the By Rows or By Columns drop-down item. In the Look in field, select Values (to search cell values only) or Formulas (to search cell values and formula expressions, excluding the calculated results). To perform a case-sensitive search, select the Match Case check box. To restrict the search to the entire cell content, select the Match entire cell contents check box.

  • Click Replace in the Find & Select drop-down menu (or press CTRL+H) to search for a text string and optionally replace it with another value. The Find and Replace dialog (with the Replace tab activated) will be invoked.

    In the Find what field, enter the text or number you wish to find. In the Replace with field, enter the replacement text for your search term. Click the Replace button to replace only the value of the selected matching cell, or the Replace All button to replace all occurrences of the search term. Note that the Replace tab provides the same search options as the Find tab, with one exception: you can only select the Formulas drop-down item in the Look in box, so only the underlying formulas (not the calculated results) will be examined when searching for matches to your search term.

Expanded Search in Code

The SpreadsheetControl also allows you to find text in a range, worksheet or entire document programmatically using the Range.Search, Worksheet.Search or IWorkbook.Search methods, respectively. To set options affecting search in a document, create an instance of the SearchOptions class and pass it as a parameter to the Search method. As in the case of the user interface, you can set the following advanced options.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E4944.

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

The image below shows the result of executing the code. Today's date is located in the expense report and highlighted in light-green.

Is this topic helpful?​​​​​​​