Searching in a Rich Text Field
Notes by default does not have any in-built/native function or property which can search a Rich Text Field content.
Notes by default does not have any in-built/native function or property which can search a Rich Text Field content. I happenned to face this problem in one of my projects. Please try "GetDesiredContent" function given below. This function searches for the first word containing "*" in Body field of the given document. You may manipulate the given function to meet your requirement.
NOTE: I used array of all items in source document to get "Body" item. This is useful when notes is having multiple "Body" fields e.g. in mail document.
Function GetDesiredContent(sourceDoc As NotesDocument) 'Get Body field from list of fields Forall x In sourceDoc.items If x.Name="Body" Then Set bodyItem=x Exit Forall End If End Forall 'Get handle to Body field bodyContent=Trim(bodyItem.Text) formatContent: 'Search for first occurrance of '*' pos=Instr(bodyContent,"*") If pos>0 Then pos1=Instr(pos,bodyContent," ") tempString=Left(bodyContent,pos1-1) 'Start trimming to extract "*" containing word Do While True pos1=Instr(tempString," ") If pos1=0 Then Exit Do End If length=Len(tempString) tempString=Trim(Right(tempString,length-pos1)) Loop End If 'Convert resultant content to text formattedText=Evaluate("@Text("""+tempString+""")") 'If formatted content contains blank spaces then reprocess it If Instr(formattedText(0)," ")>0 Then bodyContent=formattedText(0) Goto formatContent End If 'Return the final formatted content containing "*" GetDesiredContent=tempString End Function