利用 LotusScript 灵活操作 Lotus Notes 富文本域
操作 Notes 富文本域相关的 LotusScript 类
和操作 Notes 富文本域相关的 LotusScript 类包括:
� NotesRichTextNavigator 富文本域的导航器,用来访问富文本域中的各种元素;
� NotesRichTextRange 表示富文本域内容的一个范围,可以包括多个元素;
� NotesRichTextDocLink 表示富文本域内容的文档链接;
� NotesEmbeddedObject 表示嵌入式对象或者文件附件;
� NotesRichTextSection 表示富文本域中的一个区段;
� NotesRichTextTable 表示富文本域中的表格;
� NotesRichTextStyle 表示富文本的各种属性;
� NotesRichTextParagraphStyle 表示富文本段落的各种属性;
� NotesColorObject 表示一种颜色。
Sub Click(Source As Button)
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = s.CurrentDatabase
Set doc = New NotesDocument(db)
doc.Form = "test"
Dim rtf As NotesRichTextItem
Set rtf = doc.CreateRichTextItem ("Body")
'生成一个文本段落并设置其字体大小,颜色等属性
Dim style As NotesRichTextStyle
Set style = s.CreateRichTextStyle
Dim pstyle As NotesRichTextParagraphStyle
Set pstyle = s.CreateRichTextParagraphStyle
Dim color As NotesColorObject
Set color = s.CreateColorObject
style.FontSize = 20
style.Bold = True
pstyle.Alignment = ALIGN_LEFT
pstyle.FirstLineLeftMargin = RULER_ONE_INCH
Call color.SetRGB(123, 234, 123)
style.NotesColor = color.NotesColor
Call rtf.AppendStyle(style)
Call rtf.AppendParagraphStyle(pstyle)
Call rtf.AppendText("这是一个文本段落,靠左对齐。")
Call rtf.AddNewline(1)
'生成一个数据库链接,链接到当前数据库
Call rtf.AppendDocLink(db, "链接到当前数据库", "当前数据库")
'生成一个包含一个表格的区段
Call rtf.AppendStyle(style)
Call rtf.BeginSection("这是一个区段", style, color, True)
Call rtf.AppendText("这是区段的开始")
iRow% = 3
iCol% = 3