Version

SetStyleIdOnRuns Method

Sets the specified style id on all the runs in the hyper link.
Syntax
'Declaration
 
Public Sub SetStyleIdOnRuns( _
   ByVal characterStyleId As String, _
   Optional ByVal discardExistingFormatting As Boolean _
) 
public void SetStyleIdOnRuns( 
   string characterStyleId,
   bool discardExistingFormatting
)

Parameters

characterStyleId
Id of a character style that is in the root node's DocumentRootNode.Styles collection. If such a style does not exist then StyleId property will still be set on runs however it will be ignored (ineffective) until such a style is added to the root node's styles collection.
discardExistingFormatting
Indicates whether to set the RunNode.Settings to null on all runs.
Remarks

By default runs that are made part of a hyperlink node as a result of SetText method or various API's of RichTextDocument, such as RichTextDocument.InsertHyperlink, have their RunNode.StyleId set to "Hyperlink" id which refers to a character style that renders the text in the runs to have a hyperlink look (color and underline). However if you are manually populating runs of a hyperlink node then you may want to set their StyleId to an appropriate character style id to have the hyperlink be rendered as such or use this method to do so or change it afterwards.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also