Replacing text in the whole documentSee original GitHub issue
I’m trying to figure out if there is a way to replace some text in the entire document. So far I managed to successfully use this solution:
string xml = document._document.InnerXml; document._document.InnerXml = xml.Replace("a", "b"); document.Save(false);
But this does it only in the document part (not in footers & headers). Is there a more “official” way to do this in the library? If not, what would be the day to do it? Thank you!
- Created 7 months ago
- Comments:9 (5 by maintainers)
Top GitHub Comments
Yes and no. So I would expect someone searching for something like Your company value is 100,000$ and then a user who is actually playing with text formatting formats 10000 with bold and rest of the text with no formatting. And then you have to find 100k and replace it, but only if the full text is Your company value is 100,000$. In this case it would be two WordParagraphs or even more if they play a lot how it’s formatted. It’s a niche thing, but I can see that happening. So just leaving it as something to think about.
I think it’s not worth implementing right now, it’s a very niche thing, and when someone actually needs it, it would be more easy when there are actually real world examples and expectations on how it should behave. For now, the FindAndReplace you implemented is more than enough, for the vast majority of cases, I think 😄