LOTUSSCRIPT/COM/OLE CLASSES
Examples: AppendRTItem method
1. This script takes the Body item on document B and appends it to the end of the Body item on document A. The Body item on document B is deleted using the Remove method defined in NotesItem.
Dim docA As NotesDocument
Dim docB As NotesDocument
Dim rtitemA As Variant
Dim rtitemB As Variant
'...set values of docA and docB...
Set rtitemA = docA.GetFirstItem( "Body" )
Set rtitemB = docB.GetFirstItem( "Body" )
If ( rtitemA.Type = RICHTEXT And _
rtitemB.Type = RICHTEXT ) Then
Call rtitemA.AppendRTItem( rtitemB )
Call rtitemB.Remove
Call docA.Save( False, True )
Call docB.Save( False, True )
End If
2. This script shows you how to append one RTItem to another without a prompt to save the document. This example illustrates the use of a back-end class in the UI.
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 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
Note
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.
See Also
AppendRTItem method
Glossary
Feedback on
Help
or
Product Usability
?
Help on Help
All Help Contents
Glossary