HI Team,
I have one requirement in my current project, which I need to replace some customized words in the elements where it is present in whole document.The below peace of code facing some issues on replacing the words.
function checkWord(word,color){
local rtn = 1;
local logmsg = oid_first();
# Set disable continue search
set wrapscan = off;
# Cursor goto root of document
goto_oid(oid_caret());
# Find word & changing text color
while(rtn == 1) {
rtn = find(word, 0x0008|0x0200|0x0020);
if(rtn == 1) {
selectText = main::selection;
EditDelete;
str = '<?Pub _font FontColor="'.$color.'" ?>'.selectText.'<?Pub /_font?>';
#insert(str);
local findWithin; findWithin = V['FindWithin'];
local replFlags = flags|0x0020
replace(word, insert(str), replFlags, findWithin, current_doc())
}
}
}
example doc : -
<SimpleText>
<para>Be aware of the fire hazard, especially when working near flammable substances or vapours</para>
<para2>I am WelCome you vapours</para2>
</SimpleText>
After Replacing the out put the doc
<SimpleText>
<para>Be aware of the fire hazard, especially when working near flammable substances or vapours</para>
<para2>I am WelCome you 1</para2> // here word vapours is replaced with one.
</SimpleText>
Could you please any one do some need full help on this.
Thanks
Prashant