Introduction
One of the fastest ways to make repetitive changes throughout a long spreadsheet document is to use Find and Replace. Find helps you locate a text string or data and Replace substitutes new value for the existing string or data. The Aspose.Grid.Web 1.8 and later version provide this new feature called Search and Replace. It enables you to search and replace a specific text string or value in the worksheet at client-side by a simple dialog box. It will even allow you to look for a partial data if you are unsure about it.
The Find / Replace Dialog Box
There are two ways to open the Find / Replace Dialog:
1. When the control is active, press "CTRL-F" key to open the dialog, or press "CTRL-R" key to open the dialog with Replace button enabled.
2. Move the mouse pointer to the cells area in the worksheet, then right click the mouse and you will see a context menu appearing before you. Select Find... or Replace... option from the menu as shown below:
|
Figure: Selecting Find... option from context menu
|
After selecting Find... option from context menu, a style dialog would be opened as shown below in the figure:
|
Figure: Find / Replace Dialog
|
Using Find
Follow these steps for Searching:
- Open the Find / Replace Dialog Box.
- Type the string you want to search in the Find what: text box.
- click Find Next button to search the data.
In this way the next cell matches your find condition will be activated.
NOTE: If your searching data is not found in the worksheet, a message box will be popped up that indicates nothing found.
Searching Options
There are some searching options, you may customize in the dialog. We have provided a table given below that lists all those attributes.
|
No.
|
Option Name
|
Description
|
|
1
|
Match case
|
Indicates whether to use case sensitive in searching.
|
|
2
|
Match whole word
|
Indicates whether to match whole word in searching.
|
|
3
|
Search up
|
Indicates whether the search will be done from bottom to top.
|
|
4
|
Regular expression
|
When checked, the control will treat the string in the Find what text box as a regular expression in searching process.
|
|
5
|
Find in Formulas/Values
|
When the Formulas is selected, the control will match the formula or unformatted value of the cells if the formula or the unformatted value is present. When the Values is selected, the control will only match the displayed value of the cells.
|
Using Replace
Follow these steps for the Replacement of of text / values:
- Open the Find / Replace Dialog Box by pressing "CTRL-F" or Select the "Find..." option in the context menu (the dialog will be in finding state by default) and then click the Replace button.
- Type the string you want to replace with in the Replace with: text box.
- click Replace button to replace the data.
To replace text, open the dialog box. Enter the text you want to find in the Find what text box and the text you want to replace it with in the Replace with text box. You can choose to replace one occurence at a time by clicking Find Next button and then Replace button. Or, If you are very sure of what you are doing, choose Replace All to complete the replacement in one step.
NOTE: If the worksheet is not in EditMode, the Replace button will not be displayed.