OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Programmatically Inserting a URL / Hyperlink

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Aaron
General User
General User


Joined: 14 Nov 2003
Posts: 34
Location: Cincinnati, OH

PostPosted: Mon Dec 22, 2003 1:12 pm    Post subject: Programmatically Inserting a URL / Hyperlink Reply with quote

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
View user's profile Send private message AIM Address
dfrench
Moderator
Moderator


Joined: 03 Mar 2003
Posts: 1605
Location: Wellington, New Zealand

PostPosted: Tue Dec 23, 2003 2:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group