Subject: Will this help?
This Lotus Script code will run through a rich text fieldand search for a specific character or character code, and
replace it with another, or remove it. It can then either
replace the text back into the rich text field or place it
into a regular text field, which in turn converts it to
text.
The code below replaces all of the chr(13) and chr(10)'s,
which represent a carriage return in rich text, with an html
BR tag, then places it all into a text field.
NOTE: For this code to work the document must first be
saved.
Dim db As Notesdatabase
Dim session As New notessession
Dim rtitem As Variant
Dim doc As Notesdocument
Set db = session.CurrentDatabase
Set doc = session.documentContext
Set rtitem=doc.getfirstitem(“Body”) 'Rich text field (Body)
'This takes out all of the chr(10)s
SourceS=rtitem.text
SearchS=Chr(10) 'String to search for
ReplaceS = “” 'String to replace with
While Instr(SourceS, SearchS) > 0
SourceS = Left$(SourceS, Instr(SourceS, SearchS) - 1) +
ReplaceS + Right$(SourceS, Len(SourceS) - Instr(SourceS,
SearchS) - Len(SearchS) +1)
Wend
'This replaces the chr(13) with the BR tag
SearchS=Chr(13) 'String to search for
ReplaceS = “
” 'String to replace with
While Instr(SourceS, SearchS) > 0
SourceS = Left$(SourceS, Instr(SourceS, SearchS) - 1) +
ReplaceS + Right$(SourceS, Len(SourceS) - Instr(SourceS,
SearchS) - Len(SearchS) +1)
Wend
doc.textField=SourceS 'Places the new text into a text field
Call doc.save(False,True) 'Saves the document