Capture rich-text comments in Lotus Notes fields using LotusScript
Use the NotesRichTextStyle class in LotusScript to capture rich-text comments, such as colors and various font sizes in Lotus Notes fields.
There are many ways to capture comments in normal Lotus Notes text fields, but I needed to capture rich-text comments such as colors, different fonts, etc.
I didn't have to trim any comments, but I included the LotusScript code for that as a reference. I've found that you can capture rich-text comments using the NotesRichTextStyle class, which is available in Lotus Notes Domino 4.6 and higher.
Following is the LotusScript code I used on the QueryClose event.
Sub Queryclose(Source As Notesuidocument, Continue As Variant) On Error Goto Oops Dim db As NotesDatabase Dim session As New NotesSession Dim doc As NotesDocument Set doc = session.CurrentDatabase. GetDocumentByUNID(Source.Document. UniversalID) 'Declare the rich text items Dim vNarrativeTemp As NotesRichTextItem Dim vNarrative As NotesRichTextItem Dim itemN As Variant 'set the rich text items itemN = doc.GetItemValue("NarrativeTemp") Set vNarrativeTemp = doc.GetFirstItem ("NarrativeTemp") Set vNarrative = doc.GetFirstItem("Narrative") Dim richStyle As NotesRichTextStyle Set richStyle = session.CreateRichTextStyle 'Narrative Field If (itemN(0) <> "")Then richStyle.Bold = True Call vNarrative.AppendStyle(richStyle) Call vNarrative.AppendText(Format$(Now, "mm/dd/yy hh:nn AM/PM") & " by " & session.CommonUserName & ": ")
![]() |
||||
|
![]() |
|||
![]() |
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip library by member Ron Sorrell. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.