When i read a docx file (without Word Application Scope) and print result its look like this:
“\r\nTEST\r\n23\r\nTest15\r\n”
My task is to Replace “\r\n23\r\n” to another value. When i use DocumentReplaceText activity with Search value “environment.NewLine+“23”+environment.NewLine” or “vbCrLf+“23”+vbCrLf” or “chr(13)+chr(10)+“23”+chr(13)+chr(10)”, this values cannot be found. How can i solve it?
I don’t think you need to worry about the carriage returns and line feeds. Just replace the 23.
@Assyl_Abetayev
welcome to the forum
idealy the line break in search pattern is expressed by ^p
it was working when using with Word application scope:
in case of it is not working, then also have a look on folllowing package:
Thanks for your reply, in my case i should worry, because text can contain other “23” which should not be replaced, i need replace exactly this: “\r\n23\r\n”
unfortunately it didn’t work in my test
may we ask you to share your implementation part by screenshot and snippet screenshot from word? thanks
as mentioned when using word application scope and the corresponding replact activity it was working. We do not see this implemented by refering to your screenshot. Can you change just for test purpose?
we would suggest
- to click Replace All
- checking result in Word document after running
also it is welcome to surround a feedback with some elaborating words. This helps us to understand what want to point out.
do final check on Word as well.
\u0007 looks like the typical bell char \a (in unicode) which we do face when working word text
Can you share the sample docx file
i clicked Replace All - doesn’t work
tried this: vbCr+chr(7)+“23”+vbCr+chr(7), but still doesn’t work
i did run you sample and will further analyze it. First result:
Just check following cross reference
ABC.docx (16.6 KB)
Word_ReplaceText.xaml (7.3 KB)
yes, it worked when replacing string from file, but not work when i try replace this in docx file
tested following
tested with balareva
and got:
Kindly note:
the origin file from you looks like:
the 23 is not surrounded by line break marks
So ^p23^p cannot detect the 23
search for only 23 will find also the others Test23, the Phone no
Unfortunately searhoption Whole Word is not available as we do have in Word
Fazit:
^p detect linebreaks
^p23^p is not the text present in the document
23 + whole word search option not abailble in activity
lol, why in my PC it looks like this:
maybe this is the reason, what can i do)?
didnt get you
was turning on other view for more clear visualization
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.