After using Appendrtitem new RichText field shows only first line

Hi

I use appendrtitem method to copy richtext field from one document to another. Code works fine, but if i have a in source field it generates problem. All data is copied properly but field in second document shows the content from source field only to the first .

Have anyone of you any idea what could be the reason?

Subject: QueryClose? How about …

… needing to launch the whole thing as an agent.

When you hold the doc open in foreground, even after it’s been saved & is still in QueryClose, the Notes editor gets involved.

The easiest way to work around that issue is to launch an agent after the document has been closed.

Your QueryClose does not have the on-disk version of the richtext item in memory, so you’re catching it in midstream. And it’s gonna be unpleasant whatever you try to do within the QueryClose.

If you truly, really need to do something in the QueryClose that can’t be extracted from the rest … I would say try harder, but it’s also possible you can squeeze something in by loading the on-disk document from an entirely different method, like GetDocumentByUNID(). It is very dicey what you end up with though.

Subject: Um, I haven’t seen this per se, but I’ve seen something like it.

If your appended RT item were constructed by program, call rtitem.Update / rtitem.Compact before appending it.

If your original RT item to append exists at all in a document, call NotesDocument.ComputeWithForm(true, false) … and verify the result of that run is “true” (no errors on form). If it isn’t always true, call rtitem.Update / rtitem.Compact before trying to append anything to this original RT item. But don’t do both to the original RT item.

Finally – when you’re done appending – One more ComputeWithForm with the result. And if it fails, rtitem.Update / rtitem.Compact .

In short: Appending two RT items presupposes that they’re both “pretty clean”. These functions will try to make them “pretty clean” so nothing horrible happens. And yes, exactly this “disappearing paragraph” problem has occurred to me when appending RT items. I corrected it with a ComputeWithForm call after trial / error on all the above. So ComputeWithForm seems to do the best by me.

Subject: (nm)

Subject: (nm)

Subject: Could you please look at my code and tell me what should i correct?

This code is called in Queryclose

Dim doc As NotesDocument
Dim memo As NotesDocument
Dim zalacznikiRTItem As NotesRichTextItem
Dim KartaProjektu As NotesRichTextItem
Dim RaportKoncowy As NotesItem

Dim attDoc As NotesDocument
Dim rtitem As NotesRichTextItem
Dim memoItem As NotesRichTextItem
Dim item As NotesItem
Dim editors As Variant
Dim s As New NotesSession
Dim CRLF As String
CRLF = Chr(10)

Call source.Refresh
Set doc = Source.Document
Set db =doc.ParentDatabase
If Not doc.IsNewNote Then
Set KartaProjektu = doc.GetFirstItem(“Materialy”)
Call doc.ComputeWithForm(False,True)
Call KartaProjektu.Update
Set RaportKoncowy = doc.GetFirstItem(“Materialy”)
If Not (KartaProjektu Is Nothing) Then
Set attDoc = db.CreateDocument
Call attDoc.ReplaceItemValue(“Form”, “MaterialyDodatkowe”)
Call attDoc.ReplaceItemValue(“Author”, s.UserName)
Set rtitem = New NotesRichTextItem(attDoc, “Attachment”)
Call rtitem.Update
Call rtitem.AppendRTItem( KartaProjektu)
Call attDoc.MakeResponse(doc)
Call attDoc.ReplaceItemValue(“Editors”, “[ZATW]”)
Call attDoc.ComputeWithForm(False, True)
Call rtitem.Update
attDoc.SaveOptions=0
Call attDoc.Save(False, True)
Set item = doc.GetFirstItem(“Materialy”)
If Not (item Is Nothing) Then
Call item.Remove
End If
doc.MaterialyID=attDoc.UniversalID
Call doc.Save(True, False)

End If
End If

Subject: (nm, the forum does this to me)

Subject: (nm, the forum does this to me)

Subject: QueryClose? How about …

… needing to launch the whole thing as an agent.

When you hold the doc open in foreground, even after it’s been saved & is still in QueryClose, the Notes editor gets involved.

The easiest way to work around that issue is to launch an agent after the document has been closed.

Your QueryClose does not have the on-disk version of the richtext item in memory, so you’re catching it in midstream. And it’s gonna be unpleasant whatever you try to do within the QueryClose.

If you truly, really need to do something in the QueryClose that can’t be extracted from the rest … I would say try harder, but it’s also possible you can squeeze something in by loading the on-disk document from an entirely different method, like GetDocumentByUNID(). It is very dicey what you end up with though.