Domino Code Fragment

Code Name*
How to Append One RTItem to Another via LotusScript Without a Save Prompt
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.128.199.88
Description*
How to Append One RTItem to Another via LotusScript Without a Save Prompt
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Note, however, that the changes are not visible until the document (after the script has completed) is closed and reopened. Also note that the AppendRichTextItem method appends only the first 32K of a RichTextItem; the remainder is truncated.
Files/Graphics attachments (if applicable): Code:
Problem:
Using LotusScript, is it possible to append one RichTextItem (RTItem) to another but without

a prompt to save the document?

Solution:
Below is a sample script that illustrates how to append one RTItem to another using

LotusScript. Note, however, that the changes are not visible until the document (after the
script has completed) is closed and reopened. Also note that the AppendRichTextItem method
appends only the first 32K of a RichTextItem; the remainder is truncated.

Sample Script:

Sub Click(Source As Button)

Dim w As New notesuiworkspace
Dim uidoc As notesuidocument
Dim docA As NotesDocument


Dim rtitemA As Variant
Dim rtitemB As Variant


Set uidoc=w.currentdocument
Set docA=uidoc.document
Call uidoc.save
'...set values of docA and docB...
Set rtitemA = docA.GetFirstItem( "Body" )
Set rtitemB = docA.GetFirstItem( "Body1" )


If ( rtitemA.Type = RICHTEXT And rtitemB.Type = RICHTEXT ) Then
Call rtitemA.AddNewLine( 1 )
Call rtitemA.AppendRTItem( rtitemB )
docA.body1=""
doca.saveoptions="0"
Call docA.Save( False, True )
Call uidoc.close
End If


End Sub

Supporting Information:
The NotesRichTextItem LotusScript class is a back-end class. As shown above, it is possible

to use it in the UI.