Hyperlink Style

Technical support for Spire.Doc

Moderator: iceblue support

Hyperlink Style

Postby smilesunshine99 » Wed Jan 19, 2011 2:41 am

When I insert hyperlinks in Word. The words with hyperlinks are underlined automatically. If I don't just want to make the words with hyperlinks be in different color from other words without underline. How should I do?
Posts: 8
Joined: Tue Dec 21, 2010 7:09 am

Re: Hyperlink Style

Postby iceblue support » Wed Jan 19, 2011 7:29 am

Thank you for your inquiry!
Hyperlink is a field, and there are some nodes in it. According to your requirement, you may set the format of the hyperlink by operating the textRange node. The textRange node is the third node of the hyperlink, so you should use NextSiling method to obtain the textrange node and set it. Code:
Field hyperlink = paragraph.AppendHyperlink("www.e-iceblue.com", "www.e-iceblue.com", HyperlinkType.WebLink);
TextRange text = hyperlink.NextSibling.NextSibling as TextRange;
text.CharacterFormat.Bold = true;
text.CharacterFormat.UnderlineStyle = UnderlineStyle.None;
e-iceblue support
User avatar
iceblue support
Posts: 244
Joined: Tue Dec 21, 2010 2:56 am

Return to Spire.Doc

Who is online

Users browsing this forum: No registered users and 2 guests