Lotus Software logo
IBM Lotus Domino Designer 8.5
  Versions 8.5 and 8.5.1






Examples: NotesRichTextItem class

  1. This script creates a new rich text item called ProjectDescription and adds a text value to it.
  2. Dim doc As NotesDocument
    
    Dim rtitem As NotesRichTextItem
    '...set value of doc...
    Set rtitem = New NotesRichTextItem _
    ( doc, "ProjectDescription" )
    Call rtitem.AppendText _
    ( "Cartoon book for children ages 9-12" )
    Call doc.Save( False, True )
  3. This script achieves the same result as the one above, but also copies the newly created rich text item to a second document. Because NotesRichTextItem inherits from NotesItem, the rtitem object can use methods defined in both NotesRichTextItem (such as AppendText) and NotesItem (such as CopyItemToDocument).
  4. Dim docA As NotesDocument
    
    Dim docB As NotesDocument
    Dim rtitem As NotesRichTextItem
    '...set values of docA and docB...
    Set rtitem = New NotesRichTextItem _
    ( docA, "ProjectDescription" )
    Call rtitem.AppendText _
    ( "Cartoon book for children ages 9-12" )
    Call rtitem.CopyItemToDocument( docB, "" )
    Call docA.Save( False, True )
    Call docB.Save( False, True )
  5. This script creates a new NotesRichTextItem called "Body" on a mail memo. It uses the AppendDocLink method to place a doclink to the current document in the Body, and the Send method to mail the memo to Frank Glennel.
  6. Dim session As New NotesSession
    
    Dim db As NotesDatabase
    Dim memo As NotesDocument
    Dim rtitem As NotesRichTextItem
    Set db = session.CurrentDatabase
    '...set value of doc...
    Set memo = New NotesDocument( db )
    Set rtitem = New NotesRichTextItem( memo, "Body" )
    Call rtitem.AppendDocLink( doc, db.Title )
    memo.Subject = "Here's a link to the document"
    Call memo.Send( False, "Frank Glennel" )
  7. This script gets an existing rich text item called ProjectDescription and adds a carriage return and a text value to it. Notice how rtitem is declared a variant, since the GetFirstItem method returns a NotesItem that may or may not be a NotesRichTextItem. Since Type is a property defined in NotesItem, you can use it with a NotesRichTextItem as well. The script tests the variant to see if it is rich text; if so, it uses NotesRichTextItem methods on the variant. For more information, see the GetFirstItem method in NotesDocument.

Dim doc As NotesDocument

Dim rtitem As Variant
'...set value of doc...
Set rtitem = doc.GetFirstItem( "ProjectDescription" )
If rtitem.Type = RICHTEXT Then
Call rtitem.AddNewLine( 1 )
Call rtitem.AppendText _
( "Book is 64 pages, full color." )
End If
Call doc.Save( False, True )
Related topics
NotesRichTextItem class




Library | Support | Terms of use |

Last updated: Monday, October 5, 2009