Word .NET > Tutorial > Replace text

The example shows you how to open a document and replace text. Replace searches the whole document, including tables, headers, footers, footnotes, endnotes, comments and text boxes, and returns the number of replaced occurrences. All properties of the replaced text, for example font, size, color or style, remain unchanged, even when an occurrence is split over several runs.

C# example
C# example - Replace in the body only
VB example

Need help? Ask our developers: