Button Code to Append one RTF on another RTF (Rich Text Field)

Author: Tripp W Black

Created: 10/22/2000 at 07:09 PM

 

Category:
Notes Developer Tips
Forms/Subforms, LotusScript

Sub Click(Source As Button)
Dim s As New notessession
Dim db As notesdatabase
Dim doc As notesdocument
Dim rt1 As NotesRichTextItem
Dim rt2 As NotesRichTextItem

Dim w As New notesuiworkspace
Dim uidoc As notesuidocument
Set uidoc = w.CurrentDocument
Set doc = uidoc.document
Set db = s.currentdatabase

Call uidoc.save()
Call uidoc.close

Set RT1 = doc.getfirstitem("RTF1")
Set RT2 = doc.getfirstitem("RTF2")
' check if they are really RT items
If ( RT1.Type = RICHTEXT And _
RT2.Type = RICHTEXT ) Then
' move the rtitem1 to the rtitem2
Call rt1.AppendRTItem( rt2 )
' add a single line to the rtitem1 so that the next append is in a new line
Call rt1.AddNewLine( 1 )
' delete the other rtitem
Call rt2.Remove
End If

docUNID = doc.UniversalID
' doc.form = "frmCheckList"
Call doc.Save(False, False)

'Set save options to zero so that user does not get prompted to save after closing uidoc
doc.saveoptions = "0"
Call uidoc.close
'Find the document again based on UNID and open it up
Set doc = db.GetDocumentByUNID(docUNID)
Set uidoc = w.Editdocument(True, doc)

'Reset doc and set saveoptions back to "1"
Set doc = uidoc.document
doc.saveoptions = "1"

End Sub


previous page