We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

doc.Range.Replace obselete

I have just installed the latest version of Aspose only to find masses of warnings for using doc.Range.Replace.


I don’t understand the change, do I now have to write a class for each replace I want to set up?

For example, I have

string CandidateName = “Testy McTesty”;
const string tgCandidateName = @"[name]";
doc.Range.Replace(tgCandidateName, CandidateName, false, false);
I just want to do a simple text replace.

I also do this within tables

table.Range.Replace(IndexTag, SkillAreaIndex.ToString(), false, false);
What changes do I need here?

How do I write this in your new way of doing things?

Or can I just leave it because it still seems to work as it is!

Hi there,

Thanks for your inquiry. Please check the code examples shared in following documentation link.
Find and Replace

Please check the Range.Repalce API changes in following link.
Aspose.Words for .NET 16.7.0 Release Notes

Please check the highlighted code snippet below and let us know if you have any more queries.

string CandidateName = "Testy McTesty";

const string tgCandidateName = @"[name]";

FindReplaceOptions replaceOption = new FindReplaceOptions();

doc.Range.Replace(tgCandidateName, CandidateName, replaceOption);