Class ReplaceOptions
Contents
[
Hide
]ReplaceOptions class
Represent the replace options.
public class ReplaceOptions
Constructors
Name | Description |
---|---|
ReplaceOptions() | The default constructor. |
Properties
Name | Description |
---|---|
CaseSensitive { get; set; } | Indicates if the searched string is case sensitive. |
FontSettings { get; set; } | The rich formatted settings for the replaced text. |
MatchEntireCellContents { get; set; } | Indicates whether to match entire cells contents |
RegexKey { get; set; } | Indicates whether the searched key is regex. If true then the searched key will be taken as regex. |
Examples
[C#]
namespace Demos
{
using Aspose.Cells;
using System;
public class ReplaceOptionsDemo
{
public static void ReplaceOptionsExample()
{
// Create a new workbook
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
// Add some sample data to the worksheet
sheet.Cells["A1"].PutValue("Hello World");
sheet.Cells["A2"].PutValue("Hello Aspose");
sheet.Cells["A3"].PutValue("Goodbye World");
// Create ReplaceOptions
ReplaceOptions options = new ReplaceOptions
{
CaseSensitive = false,
MatchEntireCellContents = false,
RegexKey = false
};
// Replace "Hello" with "Hi" in the worksheet
int replacedCount = workbook.Replace("Hello", "Hi", options);
// Output the number of replacements made
Console.WriteLine($"Number of replacements made: {replacedCount}");
// Save the workbook
workbook.Save("ReplaceOptionsExample.xlsx");
}
}
}
See Also
- namespace Aspose.Cells
- assembly Aspose.Cells