I am trying to display a rich text on the web in a view an I want that ppl see it as I entered it ( list , new lines , etc.)
As I’ve read in this forum this can’t be done with a regular notes view so I’ve tried to build an agent that generate the page, but I’m having problem with that too. I can’t access the richtext item .
I’ve tried with richtextnavigator and range but the agent keeps enters in an infinite loop. I took the code from the example from the help. Here is the code:
Set rtnav = body.CreateNavigator
Set rtrange = body.CreateRange
If rtnav.FindFirstElement(RTELEM_TYPE_TEXTPARAGRAPH) Then
searchString$ = Inputbox$("Enter search string:", _
"Search string")
Do
Call rtrange.SetBegin(rtnav)
If Instr(rtrange.TextParagraph, searchString$) <> 0 Then
Messagebox _
"Text paragraph: " & rtrange.TextParagraph _
,, "Found """ & searchString$ & """"
Exit Sub
End If
Loop While rtnav.FindNextElement(RTELEM_TYPE_TEXTPARAGRAPH)
Messagebox searchString$,, "Not in Body"
Else
Messagebox "No element of this type in Body",, _
"No paragraph"
End If
Of course I’ve replace messagebox with print
Please help. I’m stuck
I would appreciate any ideeas on how to solve my main problem(that is richtext on the web in an view)
the reason for ur code going into unconditional looping is when you try to use FINDNEXTELEMENT in richtextnavigator class if it is the last element then finding next element reades the same Lastelement
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim body As NotesRichTextItem
Dim rtnav As NotesRichTextNavigator
Dim rtnav1 As NotesRichTextNavigator
Dim rtrange As NotesRichTextRange
Dim rtrange1 As NotesRichTextRange
Set db = session.CurrentDatabase
Set dc = db.UnprocessedDocuments
If dc.Count = 0 Then
Messagebox "No document selected",, "No doc"
Exit Sub
End If
Set doc = dc.GetFirstDocument
Set body = doc.GetFirstItem("Body")
Set rtnav = body.CreateNavigator
Set rtnav1 = body.CreateNavigator
Set rtrange = body.CreateRange
Set rtrange1 = body.CreateRange
rtnav1.FindLastElement(RTELEM_TYPE_TEXTPARAGRAPH)
Call rtrange1.SetBegin(rtnav1)
Last=rtrange1.TextParagraph
rtnav.FindFirstElement(RTELEM_TYPE_TEXTPARAGRAPH)
Call rtrange.SetBegin(rtnav)
Do Until Next1=Last
Next1=rtrange.TextParagraph
result1= result1+rtrange.TextParagraph
ddd=rtnav.FindNextElement(RTELEM_TYPE_TEXTPARAGRAPH)
Call rtrange.SetBegin(rtnav)
Loop
Msgbox result1