Using C#, is there a good way to find and replace a text string in a docx file without having word installed on that machine?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Yes, using Open XML. Here's an article which addresses your specific question: Creating a Simple Search and Replace Utility for Word 2007 Open XML Format Documents
回答2:
You may also try Aspose.Words for .NET in order to find and replace text in Word document. This component doesn't require MS Office to be installed. The API is quite simple and easy to use and implement.
Disclosure: I work as developer evangelist at Aspose.