I have a form that contains a rich text field called Details, which is set to Display using Java Applet. I have entered text into the field via the web and saved it. When I try to pick the data up using the following code (which I took from the notes help and modified the rich text field name to suit my needs), the msg is empty:
Dim dc As NotesDocumentCollection
Dim body As NotesRichTextItem
Dim rtnav As NotesRichTextNavigator
Dim rtrange As NotesRichTextRange
Set db = session.CurrentDatabase
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
Set body = doc.GetFirstItem("Details")
REM Find paragraphs in Body item
Set rtnav = body.CreateNavigator
If rtnav.FindFirstElement(RTELEM_TYPE_TEXTPARAGRAPH) Then
Set rtrange = body.CreateRange
count% = 0
Do
count% = count% + 1
msg$ = ""
REM Set range for paragraph and display it
Call rtrange.SetBegin(rtnav)
msg$ = rtrange.TextParagraph
Print msg$ & " - Paragraph " & count%
Loop While rtnav.FindNextElement(RTELEM_TYPE_TEXTPARAGRAPH)
Else
Print "No text in Body"
End If
I don’t receive any error messages, so it just seems as though the field is empty.
I have posted several questions over the past couple of days with regards to accessing the rich text in a rich text field, and have had a lot of help to get me started. So I have been using examples in notes help to try and get a better understanding of these features, but have yet been able to get anything to work!!!
Any ideas about what I may be doing wrong would be greatly appreciated, thanks in advance.
Subject: Rich Text via the Web - Code Included
Lisa
How are you saving the form? Whenever I use the java applet I always use javascript, and do the following:
_getEditAppletData();
window.document.forms[0].submit;
This ensures that the content you have written in the java applet is written back to the underlying notes document.
Hope that helps
Ben
p.s. You may find that using the “Best fit for O/S” option on your Rich text field editor works better for you - it uses an ActiveX control instead of a java applet, if the browser supports it.
Subject: Rich Text via the Web - Code Included
my understanding is that once you edit RT field using Java applet you store back not Notes rich text anymore, but MIME. And it’s a sad joke of a rich text + something you will not be able to access using Notes rich text classes – NotesRichTextNavigator and all.
Subject: RE: Rich Text via the Web - Code Included
Thanks for all of the responses.
After another couple of days reviewing the NotesRichTextNavigator, etc. I decided that, while it would have been a nice option, rich text is not necessary. The amount of time I have already spent pursuing this option already has eaten up enough time!
Once again, thanks to all.
Subject: Rich Text via the Web - Code Included
I m not sure if you want to get the pure text (without formating). If yes, below is the code
===============
Set body = doc.GetFirstItem(“Details”)
body.text
Subject: RE: Rich Text via the Web - Code Included
I had done a simple test with my Db.
below is my code, I had tested with italics, bold, underline, bullet, link, and international character. All of them can be display out, but without their formatting.
======================
Dim s As New NotesSession
Dim v As NotesView
Dim doc As NotesDocument
Dim itm
Set v=s.CurrentDatabase.GetView(“Untitled”)
Set doc=v.GetLastDocument
Set itm=doc.GetFirstItem (“fld01”)
Msgbox itm.text
Set s=Nothing
Subject: RE: Rich Text via the Web - Code Included
The Text property is just text, not text with codes or innerhtml or anything else. Just plain text.