I am extracting html from a website and is writing the output html to a word document using c#. I have completed this by using httpwerequest and by html parsing. My final step is to highlight a specific link in the word document if it contains a anchor keyword. For example I am getting several links in the html which i wrote to word like
- Kroger recalls selections of spinach packages
- Kroger recalls spinach over Listeria risk
- Buy Safeway And Sell Whole Foods
These are all hyperlinks. I want to highlight those links which contain the anchor keyword named Kroger. So only the first two links will be highlighted in word document.How to achieve this?. Thanks in advance.
This article may help to achieve what you are looking for:
Search and highlight text in MS Word through C#
From there, using
Microsoft.Office.Interop.Word, you can:HighlightColorIndexproperty (e.g. a value ofwdYellow). More info on MSDN also for this one.