Examples: NotesRichTextStyle class

This example builds a rich text item using text solicited from the user. Style attributes are set so that the text appears in 14-point Courier.

Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Set db = session.CurrentDatabase
  Dim doc As New NotesDocument(db)
  Call doc.AppendItemValue _
  ("From", session.UserName)
  Call doc.AppendItemValue _
  ("Subject", Inputbox("Subject?"))
  Call doc.AppendItemValue _
  ("Categories", Inputbox("Category?"))
  Dim richStyle As NotesRichTextStyle
  Set richStyle = session.CreateRichTextStyle
  richStyle.NotesFont = FONT_COURIER
  richStyle.FontSize = 14
  Dim richText As New NotesRichTextItem(doc, "Body")
  Call richText.AppendStyle(richStyle)
  newPara = Inputbox _
  ("Paragraph of text for ""Body"" item")
  firstPara = True
  While newPara <> ""
    If firstPara Then
      firstPara = False
    Else
      Call richText.AddNewLine(2)
    End If
    Call richText.AppendText(newPara)
    newPara = Inputbox _
    ("Paragraph of text for ""Body"" item")
  Wend
  Call doc.Save(True, False)
End Sub