Examples: Text property

  1. This script uses the Text property to get the contents of the Categories item, which is a text list. Suppose Categories contains three values: "pine tree," "maple tree," and "spruce tree." The Text property returns the string "pine tree;spruce tree;maple tree" and places it in the contents variable.
    Dim doc As NotesDocument
    '...set value of doc...
    Dim item As NotesItem
    Dim contents As String
    Set item = doc.GetFirstItem( "Categories" )
    contents = item.Text
  2. This script uses the Text property to get the contents of the Amount item, which is of type Number. Suppose the Amount item contains 35.2. The Text property returns the string "35.2" and places it in the contents variable.
    Dim doc As NotesDocument
    Dim item As NotesItem
    Dim contents As String
    '...set value of doc...
    Set item = doc.GetFirstItem( "Amount" )
    contents = item.Text
  3. This function takes any NotesDocument and uses the Text property to create a plain-text rendering of it. For each item on the document whose name does not contain "$", the function places the name and text of the item into the Body item of a new document. The new document is returned to the calling routine. Note that plainItem is declared as a NotesRichTextItem only so that the script can use the AddNewLine method to insert new lines to separate each item.
    Function createPlainDoc( doc As NotesDocument ) As NotesDocument
      Dim db As NotesDatabase
      Dim plainDoc As NotesDocument
      Dim plainItem As NotesRichTextItem
      Set db = doc.ParentDatabase
      Set plainDoc = New NotesDocument( db )
      Set plainItem = New NotesRichTextItem _
      ( plainDoc, "Body" )
      itemList = doc.Items
      Forall i In itemList
        If ( Instr( i.Name, "$" ) = 0 ) Then
          Call plainItem.AppendText( i.Name + ": " + i.Text )
          Call plainItem.AddNewLine( 1 )
        End If
      End Forall
      Set createPlainDoc = plainDoc
    End Function