Set the value for a rich text filed by using lotusScript

Hi all,

I want to set the value for a rich text filed in the current uidocument by using lotusScript. How can I implement it?

The following is my method:

A form contains a rich text field “check_result” and a button. The button is used to set the value for the rich text field “check_result”.

The code of the button is like this:

Sub Click(Source As Button)

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

            Dim doc As NotesDocument



Set uidoc = ws.CurrentDocument

Call uidoc.save



Dim v As Variant

Set doc = uidoc.Document

Set v = doc.GetFirstItem( "check_result" )

If v.Type = RICHTEXT Then

	Call v.AppendText ( "Book is 64 pages." )

End If

Call doc.Save( False, True )

Call uidoc.Reload()

uidoc.Refresh

End Sub

However, it doesn’t work as what I thought. When I clicked the button, the field “check_result” still has no value in the uidocument. I checked the property of the uidocument, I found there are two fields name “check_result”. One has no value, the one has the value “Book is 64 pages.”

I don’t know what’s wrong with it.

I need your help to solve this problem.

Subject: set the value for a rich text filed by using lotusScript

Hi,

try this:

Sub Click(Source As Button)

Dim uiw As New notesuiworkspace

Dim uidoc As NotesUIDocument

Set uidoc = uiw.CurrentDocument

Call uidoc.FieldSetText(“check_result”,“Book is 64 pages”)

'take fieldappendtext to append if other data exist in the rtffield

Call uidoc.Refresh(True)

End Sub