Manage Learn to apply best practices and optimize your operations.

Lotusscript Notes Appendrtitem Method - Copy Richtextitem Font Information

When you use AppendRTItem to copy a rich text item, you will lose your font
name attribute
of the item.
Here is a workaround for this particular case. Before calling the AppendRTItem
method, you
must copy the $fonts item from the source document to the destination document.
Sub Click(Source As Button)
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim currentdoc As NotesDocument
Dim Newdoc As NotesDocument
Dim item As Variant
Dim RTItem As NotesRichTextItem
Set db = s.CurrentDatabase
Set uidoc = ws.CurrentDocument
Set Newdoc = New NotesDocument(db)
Set currentdoc = uidoc.Document
Set Item = currentdoc.GetFirstItem ( "Form" )
Newdoc.form = Item.Text
Newdoc.subject = uidoc.FieldGetText ( "Subject" )
Set item = currentdoc.GetFirstItem ( "Body" )
Set RTItem = Newdoc.CreateRichTextItem ( "Body" )
%REM
'Here we copy the font information located in the $fonts item
%END REM
Set font = currentdoc.GetFirstItem ( "$Fonts" )
Call font.CopyItemToDocument ( Newdoc , "" )
Call RTItem.AddNewLine ( 1 )
Call RTItem.AppendRTItem ( item )
Call Newdoc.save ( True , True )
End Sub

Dig Deeper on Domino Resources - Part 4

SearchWindowsServer
Search400
  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

SearchDataCenter
SearchContentManagement
Close