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

Free Support Forum - aspose.com

Find and replace Persian text

I use this code for replace a Persian word with another one in aspose.Word for .net:

var rst = builder.Document.Range.Replace("خلیج پارس", "خلیج فارس", false, true);

I’m sure there is “خلیج فارس” into my docx file. But after run that code it’s not replace. What’s wrong?
Can you suggest me a sample code for Persian language search text by Aspose.Word?

@heidarbozorg,

Thanks for your inquiry. Please ZIP and attach your input Word document here for testing. We will investigate the issue on our side and provide you more information.

AsposeProblem.zip (103.1 KB)

Thanks for your quick response. I attach a sample file.

@heidarbozorg,

Thanks for sharing the detail. We have tested the scenario using latest version of Aspose.Words for .NET 17.10 with following code example and have not found the shared issue. Please use Aspose.Words for .NET 17.10. We have attached the output document with this post for your kind reference. output.zip (9.9 KB)

Document doc = new Document(MyDir + "AsposeProblem.docx");

doc.Range.Replace("خلیج فارس", "خلیج پارس", new FindReplaceOptions());
doc.Save(MyDir + "output.docx");