I will try to explain in details what are the most important steps in order to change the style of hyperlink.
First and most important thing is to get inline which is inside a hyperlink. Such inlines are the hyperlink start and end range, and all the spans that are containing the text of the hyperlink. You can do that by navigating a document position to the required inline. Here is example on how to do that:
DocumentPosition documentPosition =
There are many convenient methods inside DocumentPosition to navigate around the document. I can recommend you to check them.
Once you have the required inline you may apply the style to the hyperlink as Deyan already showed. Here is the code sample on how to do it:
var rangeStart =
If you need to apply this style to all hyperlinks in a document you can do that by iterating over all HyperlinkRangeStart in the document and get the inline from them. Here is code sample on how to do it:
var rangeStart =
In case you need to apply the new hyperlink style only to specific hyperlink you can do that by iterate over all HyperlinkRangeStart
elements and depending on the information in the hyperlink to apply the style on the hyperlink you want.
Regarding the case when the hyperlink is inside a table or on multiline, just move the document position to the hyperlink and get the inline needed to apply the style.
Please do not forget to Begin and End the undo group if you need to be able to revert those changes in the document using the undo command.
I hope this information answers your questions. If you have further questions or comments feel free to contact us again,