I'm trying to compose a document from within the source document and have it inherit an Rich Text field. So I'm at QueryClose and it still does not come into the new UIdoc, even after I saved and reopened new UIdoc. I need to get the RTF into my new document.
Dim sourceitem As NotesItem Set sourceitem = doc.GetFirstItem( "Text" ) Dim docnew As NotesDocument Set Docnew = uidoc.document If Not sourceitem Is Nothing Then Msgbox "call sourceitem" Call sourceitem .CopyItemToDocument ( docnew , "" ) End If
I am a bit puzzled by your question and the code. When I look at the code, there is nothing there that shows me you are composing a new document. In fact, you are copying the RichTextItem to the backend class of the current UIdocument. Doing so can even cause save-conflicts, as you are working on both instances at the same time.
The following is some sample code, which shows you how to copy an RTF field to another document and then open that document in edit mode to the user. Hope this will help.
Dim s As New notesSession Dim w As New notesUIWorkspace Dim myDb As notesDatabase Dim uidoc As notesUIDocument Dim doc As notesDocument Dim newDoc As notesDocument Dim targetBody As notesRichTextItem Dim sourceBody As notesRichTextItem Set myDb = s.currentDatabase Set uidoc = ws.currentDocument Set doc = uidoc.Document Set sourceBody =doc.GetFirstItem ("Body") Set newDoc = New notesDocument (myDb) newDoc.Form = "myForm" newDoc.Field1 = Doc.Field1(0) Set targetBody = New NotesRichTextItem (newDoc, "Body") Call targetBody.AppendText ("This is a new document:") Call targetBody.AddNewLine(2) Call targetBody.AppendRTItem (sourceBody) ' to clear memory in Domino Delete targetBody '******************************** Call ws.EditDocument(True, newDoc)
Dig Deeper on LotusScript
Related Q&A from Hans Van Der Burg
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.