Hi,
I have the following code which copies the contents of one rich text field into another. It works fine in version 5, but in version 6 there is a duplicate blank “Text” field. If I resave the document it is fine.
Dim rtfieldvalue As NotesRichTextItem
Dim rtfield As NotesRichTextItem
'left
Set rtfieldvalue = livedoc.GetFirstItem("TextAlternative")
Call livedoc.ReplaceItemValue("Text","")
Set rtfield = New NotesRichTextItem(livedoc, "Text")
Call rtfield.AppendRTItem(rtfieldvalue)
Has anyone else experienced this problem or is there an alternative way I can clear the contents of the field before appending the rich text item?
As always, any ideas very much appreciated.
Thanks,
Gareth
Subject: RemoveItem version 6 issue?
This is actually expected behaviour because of the way R6 handles MIME in richtext items.you could do:
set rtfield = livedoc.getfirstitem(“Text”)
call rtfield.remove
set rtfield = livedoc.createrichtextitem…
although you may need to save after the remove.
Subject: RE: RemoveItem version 6 issue?
Thanks for your post Peter, unfortunately it produced the same result.
Dim rtfieldvalue As NotesRichTextItem
Dim rtfield As NotesRichTextItem
'left
Set rtfieldvalue = livedoc.GetFirstItem("TextAlternative")
Set rtfield = New NotesRichTextItem(livedoc, "Text")
Call rtfield.Remove
Call livedoc.Save(True, True)
Set rtfield = New NotesRichTextItem(livedoc, "Text")
Call rtfield.AppendRTItem(rtfieldvalue)
I tried it with and without the save line but it didn’t seem to make any difference.
Thanks,
Gareth
Subject: Actually, you did NOT try his code. You attempted an alternative of your own.
TRY:
Dim rtfieldvalue As NotesRichTextItem
Dim rtfield As NotesRichTextItem
'left
Set rtfieldvalue = livedoc.GetFirstItem("TextAlternative")
’ Set rtfield = New NotesRichTextItem(livedoc, “Text”)
Set rtfield = livedoc.GetFirstItem("Text")
Call rtfield.Remove
Call livedoc.Save(True, True)
Set rtfield = New NotesRichTextItem(livedoc, "Text")
Call rtfield.AppendRTItem(rtfieldvalue)
Or even better:
Call livedoc.RemoveItem("Text")