If a document is not saved the rich text item can not be copied from another rich text field. The following code creates a copy of the currently opened document from a view with all of the contents from the rich text field.
Code: Dim wsp As New NotesUIWorkspace Dim curruidoc As NotesUIDocument Dim currdoc As NotesDocument Dim ns As New NotesSession Dim db As NotesDatabase Dim item1 As NotesItem Set db=ns.CurrentDatabase Set curruidoc=wsp.CurrentDocument Set currdoc=curruidoc.Document Set item1=currdoc.GetFirstItem("att") Dim doc As New NotesDocument(db) ' create a new document in memory. Call doc.ReplaceItemValue("Form", "MailAudit") Dim rtf As NotesRichTextItem Set rtf = New NotesRichTextItem(doc, "att") '//for pasting attachmants Set rtitem2 = currdoc.GetFirstItem( "att" ) Call doc.CopyItem( item1, "att" ) '//end of pasting ' make Notes complete cached rich text changes. Call rtf.Update( ) Dim ws As New NotesUIWorkspace Call ws.EditDocument(True, doc)
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip exchange by member Milind Sahasrabudhe. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.