Find and Replace Dialog
- 4 minutes to read
The Spreadsheet control provides the built-in Find and Replace dialog that allows an end-user to find and replace specific cell data within the scope of a workbook or the currently active worksheet. This dialog is invoked when you call the ShowFindAndReplaceDialog procedure implemented in the dxSpreadSheetFindAndReplaceDialog unit. This method accepts two parameters that specify the ExpressSpreadSheet control instance for which the Find and Replace dialog window is invoked and a Boolean value indicating whether the Find or Replace tab of the dialog is active:
An end-user can invoke the Find and Replace dialog with the active Find or Replace tab by pressing the Ctrl+F or Ctrl+H key combination, respectively.
Find Tab
The Find tab of the Find and Replace dialog window is used to search and display the cell data.
All user interface elements available within the Find page are present at the Replace page as well. Both of the tabs always include the following elements:
The Find what field used for typing the text string for searching;
The Find Next button which moves the focus between cells cycling through the all found results;
The Find All button that is used to display the list of search results in the list box below;
The Close button which closes the Find and Replace dialog window;
The More Options button that is used to display the search customization settings.
The Find tab of the Find and Replace dialog window can be expanded with the search options:
The search customization settings, displayed by clicking the More Options button, include:
The Within combo box which allows end-users to set the scope of the search operation (two available options include the scope of a workbook and the currently active worksheet).
The Search combo box that allows end-users to select between row by row search from top to bottom and column by column search from left to right within the Table View‘s Dimensions area.
The Look in combo box which allows end-users to choose between two modes of searching within the cells with formula expressions. The first option corresponds to searching in the text of the formula expression stored within a cell while the second option performs searching among the calculated results, ignoring the formula sources.
The Match Case check box provides the option of case-sensitive search.
The Match Entire Cell Contents check box provides the option that limits the list of search results only to the strings that match the cell contents entirely.
The Less Options button which hides the search customization settings.
If an end-user clicks the Find All button on either the Find or Replace tab, the Find and Replace dialog displays the list box with search results:
If the Find and Replace dialog is unable to find at least a single matching value, it displays the following message:
Replace Tab
The Replace tab of the Find and Replace dialog window is used to replace certain cell data with the specified value (string). The Replace page adds replace-specific user interface elements to those found on the Find page:
The Replace With field used for typing the text string that replaces the found cell data.
The Replace button which moves the focus between cells cycling through the all search results, replacing them with the current Replace Width field value. To start replacing the found values one by one, an end-user must focus one of the found cells first.
The Replace All button that is used to simultaneously replace all found cell values with the current Replace With field value.
Similar to the Find tab, the Replace tab can be displayed without search options:
For switching between the shown and hidden search options, the Replace tab also uses the More Options and Less Options buttons:
If at least one cell value is replaced when an end-user clicks the Replace All button, the Find and Replace dialog displays a message similar to the following example:
If the Find and Replace dialog is unable to replace at least a single value, it displays the following message: