I'm trying and trying and i just can't afford last thing to end my application.
I have some phrases stored as strings, for example "Something is just". And at now my program will highlight all "Something is just", but also all "Something", all "is" and all "just" in the Word .docx text.
I don't know how make it possible, because now I'm using my document divided by words. I don't know if I should use other foreach type or maybe there is just a method of Range that could help me solve this problem.
Here is my code:
for (int i = 0; i < keyList.Count; i++)
{
foreach (Range range in doc.Words)
{
if (keyList[i].Contains(range.Text.Trim()))
{
range.HighlightColorIndex = Microsoft.Office.Interop.Word.WdColorIndex.wdDarkYellow;
}
}
}
A keyList has three-word string. Thanks for any help!