How to examine a Word document for individual words.
This code snippet searches each word individually in a Word document.
The trick: you go through Word.Document.Words as Range objects
Subject:
Code example for C #, VSTO
//--< @Loop: Words >-- foreach (Range word in _doc.Words) { //«KDNR» string sWord = word.Text; if (sWord.IndexOf("Test")>-1) {
} } //--</ @Loop: Words >--
|
To go through an addin in C # you have to embed the following
using Word = Microsoft.Office.Interop.Word; |