Replace not working

Hello,

I'm trying to understand and find a solution to replace a text in a document. 


            textTest = textTest.Replace(_if.TextoReplace, _if.NovoTexto); // This finds and replaces the text


// The code below does not find the text to replace

            await container.DocumentEditor.Search.FindAllAsync(_if.TextoReplace, FindOption.None);


            var searchResults = container.DocumentEditor.Search.SearchResults;


            var count = await searchResults.GetLengthAsync();


            if (count > 0)

            {

                await container.DocumentEditor.Editor.InsertTextAsync(_if.NovoTexto);

            }

I saw that this happens when I have a "\r" in the text. But even trying to remove "\r" it does not work. And why using pure c# replace it works?

Does anyone has any idea on how to solve this?

Best regards.


1 Reply

KM Kavitha Muralitharan Syncfusion Team July 10, 2023 01:12 PM UTC

Hi Wilton,


We were unable to replicate the exact scenario, but we have attached a simple sample. Could you please add/modify the sample with the codes you have used at your end and share the modified sample along with the video to replicate the issue for further validation?


Regards,

Kavitha M


Attachment: sample_blazor(use)_761461db.zip

Loader.
Up arrow icon