Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Count
Followers 0
Login Register as User

Word: Loop through all the words in a Word document

26.10.2018 (๐Ÿ‘70)


 

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;