object.
expression.gather(range)
expression Required. An expression that returns an IFPStyleState object.
range Required IHTMLTxtRange object. The text range to be associated with the IFPStyleState object.
Example
The following example inserts a formatted paragraph into the current document, then creates an IFPStyleState object and an IHTMLTxtRange object and uses the gather method of the IFPStyleState object (stored in the objSS variable) to associate the style properties in the IHTMLTxtRange object (stored in the objRng variable). The example then clears existing formatting in the objSS variable and applies a background color.
Sub GatherAndClearStyleProperties()
Dim objSS As IFPStyleState
Dim objDoc As FPHTMLDocument
Dim objRng As IHTMLTxtRange
Set objDoc = ActiveDocument
objDoc.body.innerHTML = "<p><b><i><u>Heading 1</u></i></b></p>"
Set objSS = objDoc.createStyleState
Set objRng = objDoc.body.createTextRange
With objSS
.gather objRng
.ClearAllFormatting
.Apply
.backgroundColor = vbBlue
.Apply
End With
Set objSS = Nothing
Set objDoc = Nothing
Set objRng = Nothing
End Sub