Skip to main content
This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.
Information Mgmt
New to Lotus
How to buy
Live demos
Technical library
Forums & community
Java™ technology
Open source
SOA and Web services
Web development
My developerWorks
About dW
Submit content

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

Notes/Domino 6 and 7 Forum



PreviousPrevious NextNext

Beta R oundthabush 19.Dec.05 06:18 PM a Web browser
Domino Designer 6.0.2 CF2 Windows XP

I hope someone can help - I'm going mad! Here is wot I am trying to achieve - it's simple but I just cannot get it to work: I have a RT field on a document containing string text only. Wherever there is a string of colour red, I am simply, at the moment, trying to change it's colour to, say, blue.

Below is some code whereby I first create a RT Navigator to the rt field on the document. I then create 2 ranges: One which I set at paragraph level and the other at text run level within the paragraph. The darn thing just does not work! Is it my coding is it a bug with navigators/ranges??

Anyhelp greatly appreciated.

Sub Click(Source As Button)

Dim uiws As New notesuiworkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As notesview
Dim rtitem1 As NotesRichTextItem
Dim doc As NotesDocument
Dim rtnav1 As NotesRichTextNavigator
Dim style1 As NotesRichTextStyle
Dim rtnavPara As NotesRichTextNavigator
Dim rtrangePara As NotesRichTextRange
Dim rtrangeRun As NotesRichTextRange
Dim paraCount As Integer
Dim runCount As Integer

Set db = session.CurrentDatabase
Set view = db.GetView("testdocs")
Set doc = view.GetFirstDocument
Set rtitem1 = doc.GetFirstItem("body")
Set rtnav1 = rtitem1.CreateNavigator

If rtnav1.FindFirstElement(RTELEM_TYPE_TEXTPARAGRAPH) Then

Set rtrangePara = rtitem1.CreateRange
Set rtrangeRun = rtitem1.CreateRange

paraCount = paraCount + 1
runCount = 0
Call rtrangePara.SetBegin(rtnav1)
Call rtrangePara.SetEnd(rtnav1)
Set rtnavPara = rtrangePara.Navigator

Call rtnavPara.FindFirstElement(RTELEM_TYPE_TEXTRUN)

runCount = runCount + 1
Call rtrangeRun.SetBegin(rtnavPara)
Call rtrangeRun.SetEnd(rtnavPara)

Set style1 = rtrangeRun.Style

If style1.NotesColor = COLOR_RED Then

oldstring = rtrangerun.TextParagraph
style1.NotesColor = COLOR_BLUE
Call rtrangerun.SetStyle(style1)
Call rtrangerun.FindandReplace(oldstring,rtrangerun.TextParagraph,1+2+4)
Call doc.Save(True, False)

'reset nav positions:
'go back to first para in rt field.

'now find para that contained red text and recreate a navigator pointing to it - this bit is ok.
If rtnav1.FindFirstElement(RTELEM_TYPE_TEXTPARAGRAPH) Then
If rtnav1.FindnthElement(RTELEM_TYPE_TEXTPARAGRAPH, paracount) Then
Set rtrangePara = rtitem1.CreateRange
Call rtrangePara.SetBegin(rtnav1)
Call rtrangePara.SetEnd(rtnav1)
Set rtnavPara = rtrangePara.Navigator
End If
End If

'now find the next text run AFTER the red text run

Set rtrangeRun = rtitem1.CreateRange

If rtnavpara.FindFirstElement(RTELEM_TYPE_TEXTRUN) Then
If rtnavPara.FindnthElement(RTELEM_TYPE_TEXTRUN,runcount) Then
Call rtrangeRun.SetBegin(rtnavPara)
Call rtrangeRun.SetEnd(rtnavPara)
End If
End If

End If

Loop While rtnavPara.FindNextElement(RTELEM_TYPE_TEXTRUN)

Loop While rtnav1.FindNextElement(RTELEM_TYPE_TEXTPARAGRAPH)

End If

End Sub

Notes Rich Text Range: Problem with... (Beta R oundthab... 19.Dec.05)
. . RE: Notes Rich Text Range: Problem ... (Marilyn Laudadi... 19.Dec.05)
. . . . RE: Notes Rich Text Range: Problem ... (Beta R oundthab... 20.Dec.05)

  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Advanced search

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds


Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds


IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Connections Cloud Developers
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums

 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
IBM Connections
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
Lotus Enterprise Integration
Lotus Protector
Lotus Quickr
Lotus SmartSuite