Problem solve Get help with specific problems with your technologies, process and projects.

Can I compose a doc within a source doc and have it inherit an RTF?

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
 Set newDoc = New notesDocument
 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
 ' to clear memory in Domino
 Delete targetBody
 Call ws.EditDocument(True, newDoc)

Dig Deeper on LotusScript

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...