Replace fields (tags) in a Word file with actual data

word
activities
uipath
#1

Hi,
I have a Word file template with unique tags which needs to be replaced with relevant data. I tried implementing using Replace Text activity in Word application scope, however this was taking a lot of time (nearly 3 seconds to replace one field). Is there any other alternative to solve this issue?

I am not very familiar of VB.Net so not sure if we can go about with that approach.

#2

@qwerty123

First read that word file and will store result in a string variable and say ‘str’. And then apply multiple replace functions at a time to replace it with your data.

Str.replace(“old”,“new”).replace (“old”,“new”)

And then write resultant data back to the word file.

#3

Hi,
Thanks for your response. I did try that approach before but the issue is will be during alignment. Also many objects such present in the word file such as lines and tables wont be retained.