Hi
I have a richtext field on a form. When a document is created, text is filled in that field. Is it possible through LotusScript to adjust parts of that text? For example change some words in other words? If it is possible what is the quickest and easiest way to do that in lotusscript?
Kind Regards
Subject: Changing text in a rich text field using LotusScript
The first thing to try is the FindAndReplace method in the NotesRichTextRangeclass. For example, there is a post discussing it, and the most common problem people have . There have been a few problems reported aside from the loss of the range, but generally this should work.
Of course, if you have a somewhat more sophisticated chore than simply searching for and replacing a string of text, such as find strings with specific fonts or inside nested tables, or if you want to do search and replace across more than text, such as inside buttons or hide-when formulas or section titles, you might need to spend a bit more and get our Midas Rich Text LSX, which will handle the more difficult stuff. Just start with the native, free stuff first so if it does what you need, you don’t have to go the commercial route.
Subject: Changing text in a rich text field using LotusScript
Yes it is. There’s a Mid command you could use in LotusScript, it accepts 2 to 3 parameters. For example:str1 = “Good day”
str2 = “night”
Mid(str1, 6, 5) = str2
this will turn str1 into “Good night”.
the first parameter is the string you want to change. The second parameter is the starting position (in this case, the 6th character), and the third parameter (optional) determines how many characters from str2 you want to use. You can use this command to change the middle of a string as well.
Hope this helps,
Carlos Dubon