Hi Michael,
from your example I do not really see that you actually do a search:
Adding some stuff to your example code:
xReplaceable = (com.sun.star.util.XReplaceable)
UnoRuntime.queryInterface(
com.sun.star.util.XReplaceable.class, ooDoc);
xReplaceDescr = (com.sun.star.util.XReplaceDescriptor)
xReplaceable.createReplaceDescriptor();
xReplaceDescr.setSearchString = "<insert your search text>";
XInterface xTextRange = xReplaceable.findFirst(xReplaceDescr);
XPropertySet xPropSet = (XPropertySet)
UnoRuntime.queryInterface(XPropertyReplace.class, xTextRange);
xPropSet.setPropertyValue("HyperLinkURL","http://www.openoffice.org");
HTH, Steffen
mt wrote:
Hello,
I'm writing a templating system using the UNO API. I managed to make te
first part (search and replace). Now I'm trying to write the second part
whera I would like to search for a given word, if found change the
attributes of the text. It seems to more or less work with standard
properties like fontweight, color, etc. But when I try to change the
HyperLinkURL property my code fires an UnknownPorpertyExcpetion. Here is
the piece of code I use for my tests:
xReplaceable = (com.sun.star.util.XReplaceable)
UnoRuntime.queryInterface(
com.sun.star.util.XReplaceable.class, ooDoc);
xReplaceDescr = (com.sun.star.util.XReplaceDescriptor)
xReplaceable.createReplaceDescriptor();
XPropertySet xPropSet = (XPropertySet)
UnoRuntime.queryInterface(XPropertyReplace.class, xReplaceDescr);
xPropSet.setPropertyValue("HyperLinkURL","http://www.openoffice.org");
I would expect this to add an URL to all my replaced fields, like it is
the case for a BOLD font for exemple. I think I don't understand the whole
textcursor concept.
I basically need to achieve the following.
- search for my text
- select the text
- add the HyperLinkURL property to the text
it seems simple byt I don't know how to extract the necesseary (it seems)
text range end cursor objects from the XSearchable result.
Any help would be appreciated.
Thanks,
Michal
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]