| View previous topic :: View next topic |
| Author |
Message |
Aaron General User

Joined: 14 Nov 2003 Posts: 34 Location: Cincinnati, OH
|
Posted: Mon Dec 22, 2003 1:12 pm Post subject: Programmatically Inserting a URL / Hyperlink |
|
|
I am having some difficulty inserting a URL into my Write document via a macro. Below is the code that I am using:
| Code: | objHyperlink = objDocument.createInstance("com.sun.star.text.TextField.URL")
objHyperlink.url = "http://www.atomicdog.com"
objHyperlink.representation = "Link Text"
objText.insertTextContent(objHyperTCursor, objHyperlink, FALSE) |
I am going about it in this manner based on the API documentation here:
http://api.openoffice.org/docs/common/ref/com/sun/star/text/textfield/URL.html#PropertiesDetails
Has anyone else had some experience with this that they could share?
Thanks in advance!
Aaron |
|
| Back to top |
|
 |
dfrench Moderator

Joined: 03 Mar 2003 Posts: 1605 Location: Wellington, New Zealand
|
Posted: Tue Dec 23, 2003 2:02 pm Post subject: |
|
|
Seems a logical thing to do (from that documentation) but...
Is the hyperlink in a write document a textfield? I don't think so. If you create one manually with insert hyperlink it does not appear in an enumeration of textfields.
The service com.sun.star.text.TextField.URL is not listed as being available to insertytextcontents see Developers Guide 7.3.5 Text Fields
You may be able to work around your issue with the dispatchhelper... record a macro to insert a hyperlink and start from that.
Now how do you locate a URL and delete it???? It is hard enough manually. |
|
| Back to top |
|
 |
|