propertyInConflict Method
Returns a Boolean that indicates if a specified style setting is different from another style setting for the same element. True indicates that the style setting is in conflict.
expression.propertyInConflict(strPropertyName)
expression Required. An expression that returns one of the objects in the Applies To list.
strPropertyName Required String. The name of a style attribute. You can get a list of style attributes from the CSS Reference on the Microsoft Developer Network (MSDN) Web site.
Example
The following example uses two styles that contain background-color properties: one in a STYLE element in the HEAD element and one in a FONT element in the BODY element. This example will display a message saying that the two style properties are in conflict.
Note If the background-color property for both styles equalled the same color, the example would display a message saying that the two style properties are not in conflict.
Sub DisplayConflict()
Dim objSS As IFPStyleState
Dim objDoc As FPHTMLDocument
Dim objHead As IHTMLElement
Dim objRng As IHTMLTxtRange
Dim objPara As FPHTMLParaElement
Set objDoc = Application.ActiveDocument
Set objHead = objDoc.all.tags("head").Item(0)
'Add a STYLE element to the HEAD element.
objHead.insertAdjacentHTML "beforeend", "<style>" & _
"<!-- .bgStyle { color: #800080; background-" & _
"color: #FF0000 } --></style>"
'Add a paragraph to the body of the document.
objDoc.body.innerHTML = "<p class=""bgStyle"">Example" & _
"<font style=""background-color: #0000FF"">Paragraph</font></p>"
'Create a style state, a paragraph, and
'a text range with which to work
Set objSS = objDoc.createStyleState
Set objPara = objDoc.body.all.tags("p").Item(0)
Set objRng = objDoc.body.createTextRange
'Move the text range to the paragraph element
'and gather the paragraph element into the
'style state object. You need to select the text
'range, and then use the gather method before the
'style state object will be usable.
objRng.moveToElementText objPara
objRng.Select
objSS.gather objRng
With objSS
If .propertyInConflict("background-color") Then
MsgBox "The property is in conflict."
Else
MsgBox "The property is not in conflict."
End If
End With
End Sub