I have this sentence to be replaced in a word document.
“Created at 24/01/2019 in Brussels.”
I need to iterate it for a lot of documents, and the date varies for all the documents.
It should be replaced by “Created at in Brussels.”
Extra clarification: the date is at the bottom of the page and the document can be 10 pages, 15 pages,… I’m looking for something like replace text: “Created at ??/??/??? in Brussels” by “Created at in Brussels.”
Hi @yannip,
Use word application scope activity to open word document and inside that scope use replace text activity to replace the text.
I have attached the workflow for your reference.solution2.zip (20.0 KB)
If want to replace all dates in the documents, you can use regex.
1.Read the word documents to a string.
2. Assign your_string= System.Text.RegularExpressions.Regex.Replace(your_string,"(\d{1,2}/\d{1,2}/\d{4})","")
If you want to replace only the dates after the string “Created at”,
assign your_string= System.Text.RegularExpressions.Regex.Replace(your_string,"(?<=Created at\s)\d{1,2}/\d{1,2}/\d{4}","")
Thanks for your reply but this will not work.
As said, a bot will be doing this subcode for more than 100 word documents.
Sometimes he has to replace “Created at 24/01/2019 in Brussels”, sometimes “Created at 25/01/2019 in Brussels”. As you can see, the date is variable.
Thanks for your suggestion. However I’m afraid this solution is not that good as I am doing other activities as well and I’m afraid of losing the existing layout when doing it this way.