I have been working with search and replaceall
functions using java and OoSDK as following,
XReplaceable xReplaceable = (XReplaceable)
UnoRuntime.queryInterface(XReplaceable.class,xTextDocument);
XReplaceDescriptor xRepDesc =
xReplaceable.createReplaceDescriptor();
xRepDesc.setPropertyValue("SearchWords", new
Boolean(true)); //for only replacement of exact complete words
xRepDesc.setSearchString("¢›¸"); //here I am
giving only one char for replacement
xRepDesc.setReplaceString("**"); //replacing
that char with another char
long nResult = xReplaceable.replaceAll(xRepDesc);
//here my all chars get replaced with specified above string
But now problem is my all strings which has as
setSearchString get replaces and also other strings which
contains setSearchString as* sub string also gets
replaced.*
for eg. I wanted to replace this string -> ¢›¸
replaces all this strings-> 1. **£ú(R)¸µ¸ .. substring
at start position also gets replaced.
2. **
.. this is only perfect replace.
3. "ú‡œ¸ú‡**
.. substring
at end position also gets replaced.
1. how do achieve only perfect replace as search string?
2. Is there replaceFirst() method so that only
first found string get replaced?
3. XReplaceable xReplaceable = (XReplaceable)
UnoRuntime.queryInterface(XReplaceable.class,*xTextDocument*);
Here can we use for only xTextContent or
xTextRange or xTextPortion instead of *xTextDocument ?*
*
*
--
Thanks and Regards,
Dinesh