Replace text in a RUN
-
Sunday, June 10, 2012 4:07 PM
Greetings everybody!
I am new in OpenXML. I am writing a program for translating a .docx document. I have a string list with the translated text for all the text nodes in the Runs. Can anybody tell me how to replace the values of these <w:t> elements using OpenXML?
All Replies
-
Sunday, June 10, 2012 5:20 PMI believe i figured this out by myself. First you have to remove the child element and then re-create it again. Please, correct me if i am wrong.
-
Monday, June 11, 2012 9:31 AM
What you are trying to do is not that easy. You should know that event words are sometimes splited into more than one w:t tag. So the algorithm for replacing words is much more complicated.
Try using Eric White's Text Replacer. It is not perfect but can do the trick for most cases.
- Marked As Answer by Forrest GuoMicrosoft Employee, Moderator Friday, June 22, 2012 4:22 AM
-
Friday, June 22, 2012 4:26 AMModerator
This article could be helpful as how to search and replact text in document part: http://msdn.microsoft.com/en-us/library/bb508261.aspx
thanks
Forrest Guo | MSDN Community Support | Feedback to manager

