2010-12-07 2 views
0

두 개의 richtext 필드의 문자열을 비교할 수있는 lotusscript 코드가 필요합니다. form1과 form2라는 두 개의 폼이 있고 각각의 폼에는 "body"와 "body1"이라는 두 개의 필드 값을 얻을 수있는 richtext 필드 이름이 있습니다.이 두 필드를 비교하고 차이점을 보여줍니다. 메시지 상자의 문자열.두 개의 richtext 필드의 문자열을 비교하는 방법

내 코드는 다음과 같습니다

Sub Click(Source As Button) 

Dim session As NotesSession 
Dim db As NotesDatabase 
Dim dc As NotesDocumentCollection 
Dim doc, doc1 As NotesDocument 
Dim text1 As NotesItem 
Dim text2 As NotesItem 
Dim str1 As String 

Set session = New NotesSession 
Set db = session.CurrentDatabase 
Set dc = db.UnprocessedDocuments 
Set doc = dc.GetFirstDocument 
Set doc1=dc.GetNextDocument(doc) 

Set text1=doc.getfirstitem("body") 
Set text2 = doc1.getfirstitem("body1") 

'Forall v In text1.Values 

v=text1.Values 
v1=text2.Values 
Messagebox(v) 
Messagebox(v1) 
If Len(v) =Len(v1) Then 
    Msgbox"both the fields have same number of strings" 
Else 
    If Len(v) >Len(v1) Then 
    Msgbox"the length of the string in body field of form1 is greater" 
    Else 
    Msgbox"the length of the string in body1 field of form2 is greater" 
    End If 
End If 


End Sub 

답변

0

당신은 간단한 텍스트은 diff 알고리즘을 구현해야합니다. 당신이 바퀴를 재발 명하고 싶지 않다면, 나는 VB diff 기능을 잡아 Lotusscript에 적용하는 것이 좋습니다.