Searching and replacing text in an Open XML WordprocessingML document is not awfully difficult, but there are a few issues that complicate the process. The text that you are searching for may span multiple runs, so the algorithm that searches for text needs to take this into account. The replacement text should have the character formatting of the first character of the string in the document that matches the search string. I’ve written a blog post at OpenXMLDeveloper.org that presents the algorithm, as well as example code written using XmlDocument (Microsoft’s implementation of XML DOM). In addition, I’ve recorded a screen cast that explains the algorithm:
Walks through an algorithm to search and replace text in an Open XML WordprocessingML document.