developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks




Need to replace text in rich text
Pranesh Vaidya 09/11/2018 10:03 AM
Applications Development All Releases All Platforms


I would like to replace some text in rich text with blank. I have below code which gives error: Error 4503: RichText context position is not defined// in xx function: Line No 43

I have tried to place element type Text_RUN.. but did not work. Please help.

Set nav = TargetRTItem1.CreateNavigator
While nav.FindFirstString("Click on this doclink to view the attachments :")
Set nav = TargetRTItem1.CreateNavigator
Set range = TargetRTItem1.CreateRange

**** Error on below line// ***********
Call range.SetBegin(nav)
**** Error on below line// ***********
Call range.SetEnd(nav)
Call range.Remove
Call TargetRTItem1.BeginInsert(nav)
For x = 0 To UBound(textToReplace) ' Array containing values to replace
Call TargetRTItem1.AppendText(textToReplace(x))
MsgBox "Text rem"
'If x <> UBound(textToReplace) Then Call TargetRTItem1.AddNewline(1)
Next
Call TargetRTItem1.EndInsert
Call TargetRTItem1.Compact
Call TargetRTItem1.Update
Set nav = TargetRTItem1.CreateNavigator
Set range = TargetRTItem1.CreateRange
Wend
Call docArchive.Save(True,False)

Go back