@Abdelmageed_Mostafa,
Thank you for the feedback.
Good to know that your solution is compiled. Regarding the breaking changes, since you were using quite an older version and lot of changes and upgradations are done since then. It is quite difficult to provide the exact difference between your previous version and current version. However, you may check your solution for any deprecated calls and replace them with the alternate calls (if any). Once there is no deprecated call and your solution is compiling, you are good to go. If you feel any problem with the new version, please share the detailed description, runnable sample code, program output and expected output for our analysis. Same is the requirement for your current replace issue. Please share your template file and expected output file created by MS Excel file for our reference. We will test the scenario and provide assistance accordingly.
Just for your consumption, sample code is given here which uses regex for finding text in a sample Excel file. Please refer to it for the usage of regex.
//string testStr = "[hello], [list3], [another_example]. However";
//string regEx = "\\[[a-zA-Z0-9_]+]";
string testStr = @"[hello], [list3
], [another_example].
However";
string regEx = "[\r\n]+";
Regex reg = new Regex(regEx);
MatchCollection v = reg.Matches(testStr);
//regEx works fine and finds 3 matches
foreach (Match m in v)
{
Console.WriteLine(m.ToString());
}
Workbook workbook = new Workbook(filePath + "sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
FindOptions options = new FindOptions();
options.RegexKey = true;
options.LookInType = LookInType.Values;
options.LookAtType = LookAtType.Contains;
options.SetRange(new CellArea() { StartColumn = 0, EndColumn = 0, StartRow = 0, EndRow = 20 });
//options.IsRangeSet = true;
//Cells.Find method does not find any cell with regEx
Aspose.Cells.Cell found = null;
do
{
found = worksheet.Cells.Find(regEx, found, options);
if (found == null)
break;
Console.WriteLine($"Name = {found.Name}, {found.Value}");
} while (found != null);
workbook.Save(filePath + "output.xlsx");