Examples: FormatDocument method

  1. This script performs a full-text search on the current database, creates a rendering of the first document in the resulting collection, and mails the rendered document to Susanna Tallan.
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim collection As NotesDocumentCollection
    Dim newsletter As NotesNewsletter
    Dim doc As NotesDocument
    Set db = session.CurrentDatabase
    Set collection = db.FTSearch( "botany", 0 )
    Set newsletter = New NotesNewsletter( collection )
    Set doc = newsletter.FormatDocument( db, 1 )
    Call doc.Send( False, "Susanna Tallan" )
  2. This script performs a full-text search on the current database. For each document in the resulting collection (which contains a maximum of three documents), the script creates a rendering of the document, copies the Subject item of the original document into the rendering, and sends the rendering to Susanna Tallan.
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim collection As NotesDocumentCollection
    Dim newsletter As NotesNewsletter
    Dim doc As NotesDocument
    Dim j As Integer
    Set db = session.CurrentDatabase
    Set collection = db.FTSearch( "botany", 3 )
    Set newsletter = New NotesNewsletter( collection )
    ' for every document in the newsletter's collection
    For j = 1 To collection.Count
      ' create a rendering of the original document
      Set doc = newsletter.FormatDocument( db, j )
      ' copy subject of original document into new document
      doc.Subject = collection.GetNthDocument(j).Subject(0)
      ' send the new document
      Call doc.Send( False, "Susanna Tallan" )
    Next