次のエージェントは、フォントの異なる 3 行のテキストで構成されたリッチテキストアイテムを使用した文書を作成します。
Dim session As NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim rti As NotesRichTextItem
Dim style As NotesRichTextStyle
Sub Initialize
Set session = New NotesSession
Set db = session.CurrentDatabase
Set doc = New NotesDocument(db)
Call doc.ReplaceItemValue("Form", "Main Topic")
Call doc.ReplaceItemValue("Subject", "Three fonts")
Set rti = New NotesRichTextItem(doc, "Body")
Set style = session.CreateRichTextStyle
style.NotesFont = rti.GetNotesFont("Times", True)
Call rti.AppendStyle(style)
Call rti.AppendText("This text is in Times.")
Call rti.AddNewLine(2)
style.NotesFont = rti.GetNotesFont("Courier", True)
Call rti.AppendStyle(style)
Call rti.AppendText("This text is in Courier.")
Call rti.AddNewLine(2)
style.NotesFont = rti.GetNotesFont("Arial", True)
Call rti.AppendStyle(style)
Call rti.AppendText("This text is Arial.")
Call doc.Save(True, True)
End Sub