Examples: GetFormattedText method

  1. This script gets the Body item in a document, and writes its contents to a plain text file called PLANE.TXT. Any existing text in the file is written over. The text keeps its tabs and the default line wrapping is used.
    Dim doc As NotesDocument
    Dim rtitem As Variant
    Dim plainText As String
    Dim fileNum As Integer
    '...set value of doc...
    Set rtitem = doc.GetFirstItem( "Body" )
    If ( rtitem.Type = RICHTEXT ) Then
      plainText = rtitem.GetFormattedText( False, 0 )
    End If
    ' get a file number for the file
    fileNum = Freefile
    ' open the file for writing
    Open "c:\plane.txt" For Output As fileNum
    ' write the formatted text to the file
    Print #fileNum, plainText
    ' close the file
    Close #fileNum
  2. This script gets the Body item in a document, and appends its contents to a plain text file called .PLANE.TXT Any existing text in the file remains. The appended text is stripped of tabs and wraps every 15 characters.
    Dim doc As NotesDocument
    Dim rtitem As Variant
    Dim plainText As String
    Dim fileNum As Integer
    '...set value of doc...
    Set rtitem = doc.GetFirstItem( "Body" )
    If ( rtitem.Type = RICHTEXT ) Then
      plainText = rtitem.GetFormattedText( True, 15 )
    End If
    ' get a file number for the file
    fileNum = Freefile
    ' open the file for appending
    Open "c:\plane.txt" For Append As fileNum
    ' write the formatted text to the file
    Print #fileNum, plainText
    ' close the file
    Close #fileNum