When I am trying to append a text to rich text field which already contains some text in it, the new text is replacing the old text in the rich text field. But the requirement is to append the new text with the old text. Iam using the Appendtext method for this.
For p=1 To 6
StrDevObj = "DPObj"+Cstr(p)
Set varRTitem = hvempDevkeydoc.GetFirstItem(StrDevObj )
If ( varRTitem.Type = RICHTEXT ) Then
plainText = varRTitem.GetFormattedText( False, 0 )
End If
If plainText="" Then
Set ritem = New NotesRichTextItem(hvempDevkeydoc,StrDevObj )
Exit For
End If
Next
If ritem Is Nothing Then
Set ritem = New NotesRichTextItem(hvempDevkeydoc,StrDevObj )
Else
End If
For m=1 To Cint(RefDoc.NumOfSkillSets(0))
StrSkillElem="SkillElement"+Cstr(m)
VarSkillElem=RefDoc.GetItemValue(StrSkillElem)
For n=1 To 20
StrDevNeed="DevNeeds"+Cstr(m)+"_"+Cstr(n)
If (RefDoc.HasItem(StrDevNeed)) Then
VarDevNeed=RefDoc.GetItemValue(StrDevNeed)
If Lcase(Cstr(VarDevNeed(0))) = "yes" Then
StrSkill="Skill"+Cstr(m)+"_"+Cstr(n)+"Rat"
If (RefDoc.HasItem(StrSkill)) Then
VarSkill1=RefDoc.GetItemValue(StrSkill)
VarSkill=Strleft(Cstr(VarSkill1(0))," | ")
Call ritem.AppendText(VarSkill)
Call ritem.AppendText(", ")
End If ' If (CurrentDoc.HasItem(StrSkill)) Then
End If ' If Lcase(Cstr(VarDevNeed(0))) = "yes" Then
End If 'If (CurrentDoc.HasItem(StrDevNeed)) Then
Next ' For n=
Next ' For m=
Call hvempDevkeydoc.Save(True, False)
Here iam trying to find out of 6 rich text fields which is empty and setting the handle for that corresponding rich text and then append the text. If nothing is empty then bydefault handle is set to the last rich text and appending the text to that field. It is here iam facing the problem that instead of appending, it is replacing the text.
If Not hvempDevkeydoc Is Nothing Then
For p=1 To 6
StrDevObj = "DPObj"+Cstr(p)
Set varRTitem = hvempDevkeydoc.GetFirstItem(StrDevObj )
If ( varRTitem.Type = RICHTEXT ) Then
plainText = varRTitem.GetFormattedText( False, 0 )
End If
If plainText="" Then
Set ritem = New NotesRichTextItem(hvempDevkeydoc,StrDevObj )
Exit For
End If
Next
If ritem Is Nothing Then '
'Set ritem = New NotesRichTextItem(hvempDevkeydoc,StrDevObj ) 'here is the problem, do insteed:
ritem = varRTitem
Else
End If
For m=1 To Cint(RefDoc.NumOfSkillSets(0))
StrSkillElem="SkillElement"+Cstr(m)
VarSkillElem=RefDoc.GetItemValue(StrSkillElem)
For n=1 To 20
StrDevNeed="DevNeeds"+Cstr(m)+"_"+Cstr(n)
If (RefDoc.HasItem(StrDevNeed)) Then
VarDevNeed=RefDoc.GetItemValue(StrDevNeed)
If Lcase(Cstr(VarDevNeed(0))) = "yes" Then
StrSkill="Skill"+Cstr(m)+"_"+Cstr(n)+"Rat"
If (RefDoc.HasItem(StrSkill)) Then
VarSkill1=RefDoc.GetItemValue(StrSkill)
VarSkill=Strleft(Cstr(VarSkill1(0))," | ")
Call ritem.AppendText(VarSkill)
Call ritem.AppendText(", ")
End If ' If (CurrentDoc.HasItem(StrSkill)) Then
End If ' If Lcase(Cstr(VarDevNeed(0))) = "yes" Then
End If 'If (CurrentDoc.HasItem(StrDevNeed)) Then
Next ' For n=
Next ' For m=
Call hvempDevkeydoc.Save(True, False)