AppendRTItem and <return> value

Hello

When copying a richtext field with “AppendRTItem”, I notice that if there is a value in the field to be copied, only the first line of the field is copied.

Any idea why?

Subject: AppendRTItem and value

Hi

I have similar situation. Is your problem fixed?

Subject: RE: AppendRTItem and value

You are wrong. I have used this method many times and it appends the entire field contents, no problem.

It’s likely that your problem is caused by failure to refresh the back-end rich text item from the document you are editing. This is done by calling NotesUIDocument.Refresh(True).

Check your inputs. Display the Text property of the RTItem you’re trying to append. Does it contain the text you expected?

If the above does not solve your problem, we need more information about what you’re doing. If you’re not sure what information to supply, the C R I S P Y document might help you.

  • Andre Guirard, IBM/Lotus Development

Useful blog: Best Practice Makes Perfect

Subject: RE: AppendRTItem and value

My problem change now,

Here is the code:

Sub Initialize

Dim w As New NotesUIWorkspace

Dim uidoc, uidocnew As NotesUIDocument

Dim curdoc As NotesDocument

Dim rtitemA As Variant

Dim rtitemB As Variant



Set uidoc = w.CurrentDocument

Set curdoc = uidoc.Document



Call curdoc.ReplaceItemValue("pjtenr","0")	

Call uidoc.Save	



If curdoc.HasItem("ifmjnd") Then

	

	Set rtitemA = curdoc.GetFirstItem( "ifmjnd_1" )

	Set rtitemB = curdoc.GetFirstItem( "ifmjnd" )

	

	Call curdoc.ReplaceItemValue ("ifmjnd_1", "")

	Call rtitemA.AppendRTItem( rtitemB )

	

	curdoc.SaveOptions = "0"

	Call curdoc.Save(True, False)

	

End If



Set uidocNew = w.EditDocument(False, curdoc, , , , True)

Delete uidoc

Call uidocnew.Close(True)

End Sub

Now it is looking like this:

(this is a print screen)

You see the second line outside of the field. There is nothing under that field.

Very strange.

Subject: RE: AppendRTItem and value

When you call:

Call curdoc.ReplaceItemValue (“ifmjnd_1”, “”)

you change the item type to text, not rich text. Instead, you must Remove the item and create a new one.

See also this: Update rich text tip

Subject: RE: AppendRTItem and value

Thanks Andre for the feedback…

I change de code for this:

Call curdoc.RemoveItem(“ifmjnd_1”)

Call curdoc.CreateRichTextItem(“ifmjnd_1”)

Set rtitemA = curdoc.GetFirstItem( “ifmjnd_1” )

Set rtitemB = curdoc.GetFirstItem( “ifmjnd” )

'Call curdoc.ReplaceItemValue (“ifmjnd_1”, “”)

Call rtitemA.AppendRTItem( rtitemB )

curdoc.SaveOptions = “0”

Call curdoc.Save(True, False)

But I still getting something display outside the richtext field. Like this:

Subject: RE: AppendRTItem and value

It doesn’t appear that you read everything I sent you.