【发布时间】:2015-03-09 21:22:04
【问题描述】:
首先,表单中有一个富文本字段,其中已经输入了一个文本(对于这个场景 - “hello world”)。我将光标放在“hello”的字母“o”之后。我有一个按钮,它将打开一个带有一个文本字段的对话框,我想知道您如何能够在富文本字段中光标的当前位置从对话框中插入该字段中的文本。
到目前为止我的代码是:
Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim s As New NotesSession
Dim db As NotesDatabase
Set db = s.currentdatabase
Dim docFill As New notesdocument(db)
Call workspace.DialogBox _
( "Test", True, True, False, False, _
False, False, "Test Insert text at current position in rich text field", docFill, True, False, True )
Dim string1 As String
string1 = docFill.sampleText1(0)
Dim rts As NotesRichTextStyle
Set rts = s.CreateRichTextStyle
End Subs
End Sub
假设我在 sampleText1 文本字段中输入了“stackoverflow”。单击确定后,它将插入富文本字段中光标所在的位置。所以结果将是“hellostackoverflow world”。
也只是一个附加问题。假设我还希望文本为红色或其他字体,因此我将使用 notesrichtextstyle 类等来设计它。如果是这种情况,您将如何在富文本字段中的光标位置插入富文本?
【问题讨论】: