Transfer rich-text field content from one form to another

The code below was used on the web to populate a rich text field on the current session document with rich text contained in another back-end template document.
LotusScript


Sub Initialize
	
	Dim session As New notessession
	Dim db As notesdatabase
	Set db = session.currentdatabase
	Dim doc As notesdocument
	Set doc = session.DocumentContext
	
	Dim tview As notesview
	Set tview = db.getview("MTMPVIEW")
	Dim tdoc As notesdocument
	Set tdoc = tview.GetDocumentByKey( doc.mTemplate(0) , True )
	
	If tdoc Is Nothing Then Exit Sub
	
	Dim tbody As Variant 
	Set tbody = tdoc.GetFirstItem("BodyEntry")
	
	Dim rtitem As NotesRichTextItem
	Set rtitem = New NotesRichTextItem( doc , "mBody" )
	Call rtitem.AppendRTItem(tbody) 
	
End Sub

Posted by fbrefere001 on Tuesday June 8, 2004