Replace Special Characters in Aspose Words using Range.Replace - Not working

Dear Team,

We are getting problem while replacing special characters in Aspose.Words using Range.Replace method. We are trying to replace a word containing a symbol μ with another word. but its is not finding the text.

Here is the text that we are finding in the document “@#5μL of Racemic aryl alkynol Triol (Stage-A) crude solution#@” and replacing with another text.

Code -

Aspose.Words.Document document = new Aspose.Words.Document(FilePath);

Aspose.Words.FindReplaceOptions options = new Aspose.Words.FindReplaceOptions();
options.MatchCase = false;
options.Direction = FindReplaceDirection.Forward;
options.FindWholeWordsOnly = true;
document.Range.Replace("@#5μL of Racemic aryl alkynol Triol (Stage-A) crude solution#@", "6 microns", options)

B V Jagan Mohan
9542911133
Motto Systems

@mottosystems,

You can workaround this problem simply by disabling FindReplaceOptions.FindWholeWordsOnly option:

Document doc = new Document("C:\\Temp\\word.docx");
FindReplaceOptions options = new FindReplaceOptions();
options.MatchCase = false;
options.Direction = FindReplaceDirection.Forward;
options.FindWholeWordsOnly = false;
doc.Range.Replace("@#5μL of Racemic aryl alkynol Triol (Stage-A) crude solution#@", "6 microns", options);
doc.Save("C:\\Temp\\output.docx");