• Highlight Differences in Red

    By John Q Parker 1 decade ago

    Here's a small change to highlight differerent field values in red:

     
    Sub GetFieldValues
     Dim txt1 As String
     Dim txt2 As String
     Set rtstyle = session.CreateRichTextStyle()
     
     Call rtnav.FindNthElement(RTELEM_TYPE_TABLECELL, 4)
     Forall itemName In uniqueList
      
      If doc1.HasItem(itemName) Then
       txt1 = Cstr(doc1.GetItemValue(itemName)(0))
      Else
       txt1 = "-Field Not Found-"
      End If
      
      If doc2.HasItem(itemName) Then
       txt2 = Cstr(doc2.GetItemValue(itemName)(0))
      Else
       txt2 = "-Field Not Found-"
      End If
      
      If txt1 = txt2 Then
       rtstyle.NotesColor = COLOR_BLACK
      Else
       rtstyle.NotesColor = COLOR_RED
      End If
      
      Call rtitem.AppendStyle(rtstyle)
      
      'Column 1 –> Field Name
      Call rtitem.BeginInsert(rtnav)
      Call rtitem.AppendText(itemName)
      Call rtitem.EndInsert
      
      'Column 2 –> Value in Document 1
      Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
      Call rtitem.BeginInsert(rtnav)
      Call rtitem.AppendText(txt1)
      Call rtitem.EndInsert
      
      'Column 3 –> Value in Document 2
      Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
      Call rtitem.BeginInsert(rtnav)
      Call rtitem.AppendText(txt2)
      Call rtitem.EndInsert
      
      Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
     End Forall
    End Sub