Search.ReplaceAsync Method
- Namespace
TXTextControl.TXSheetControl. Server
- Package
TXTextControl.asTXSheetControl. Server TXTextControl.from the private NuGet feed or the supplied NuGet folderTXSheetControl. Api. dll
- Also in
TXTextControl.asTXSheetControl. Blazor TXTextControl.TXSheetControl. Api. dll
Replaces matching cells in one transaction; protection and validation are still enforced.
Syntax
public Task<int> ReplaceAsync(SearchOptions options, string replacement, CancellationToken cancellationToken = default)
Parameters
| Parameter | Type | Optional | Description |
|---|---|---|---|
options | SearchOptions | No | Supported settings for this operation; omitted settings retain documented defaults. |
replacement | string | No | Value matching replacement's declared type and the owning object's validation rules. |
cancellationToken | CancellationToken | Yes | Cancels waiting or execution as supported by this operation. |
Return Value
Task<int>.
Examples
Create the sample document data first, then use Search.ReplaceAsync. The returned value can be used by the calling report or application.
using TXTextControl.TXSheetControl.Server;
async Task<int> UseSearchReplaceAsync(ServerSheetControl control)
{
var book = control.Workbook;
var sheet = await book.Sheets.AtAsync(0);
await sheet.Cell("A1").SetTextAsync("Consulting");
var search = book.Search;
var result = await search.ReplaceAsync(new SearchOptions(), "Consulting services");
return result;
}
Remarks
Use the member with an instance or settings object from the documented package. Await task-returning operations. Document-bound handles must be resolved again after loading or deleting their owner.