Replace Text in Document - not working for a single replacement

Hi All.

Not sure if this is already known or I’m missing something, but I think there is a problem with the “UiPath.Word.Activities.WordReplaceText” activity.

I’m using Studio 2023.4.0 Community Edition and UiPath.Word.Activities v1.16.0-preview.

I use the ‘Replace Text in Document’ inside a ‘Word Application Scope’ and I have the ‘Replace All’ button unchecked. Inside the document I have several entries of a keyword and I want to replace only the first occurence.
When I run this all the occurrences are being replaced.

Any thoughts?

P.S. I already changed my bot to do what I need to do, but was just wondering if this is an error or expected behaviour.

Hi @TheArchitect ,

We do see that you are using the Preview version, Is it the same when checked with the Stable Version ?

Hi @supermanPunch .

Tried with last stable version v1.13.1 and it has the same outcome.

Thanks.

Hi @TheArchitect

Try to downgrade package version and test the process. I hope it will work. If doesn’t help go with script like vb.net, c#, etc… to replace the word.

Regards,
Kaviyarasu N

Hi @TheArchitect ,

I’ve tried repro’ing this on a sample Word document and was unable to. In my case, it replaces the first occurrence. Would you be able to share a sample workflow with a sample document so we can investigate this further?

Thanks,
Raluca

Hi @Raluca_Laic .

I think I’ve managed to narrow the error:

  • it works fine if the text is standard, but
  • my docx file has the keyword inside several textboxes (screenshot below).

Could you please try on such a file? I get the same output: all occurences are replaced.

Thank you.

image

Hey @TheArchitect ,

Thank you for the additional information, I managed to repro it with the textboxes. I’ve filed this for our developers to investigate it further and will provide an update here.

Thanks,
Raluca

This issue has been fixed in community release for Word for 2023.6.