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

text to hyperlink in calc

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


Joined: 05 May 2007
Posts: 8

PostPosted: Mon Jul 28, 2008 8:33 pm    Post subject: text to hyperlink in calc Reply with quote

Hello, this is a pretty trivial problem, and I've searched the forum with no luck. Basically, I have an imported .csv file that contains a list of http address in one of the column. I want to write a macro that will convert this column of http address from text to a hyperlink that will go to my default browser. Thanks in advance.
Back to top
View user's profile Send private message
JerzyPiotr
General User
General User


Joined: 03 Sep 2005
Posts: 32
Location: Poland

PostPosted: Mon Jul 28, 2008 10:53 pm    Post subject: Reply with quote

try something like this for each cell
Dim aURL As New com.sun.star.util.URL
aURL.Complete = oCellSource.getString()
dim oTransformer
oTransformer = CreateUnoService("com.sun.star.util.URLTransformer")
oTransformer.parseStrict(aURL)
'oTransformer.parseSmart(aURL,"")
If isUnoStruct(aURL) Then
'place result here
oCellDest = ThisComponent.Sheets.getByName("Arkusz2").getCellRangeByName("B9")
oCell.Formula = "=HYPERLINK(""" & aURL.Complete & """)"
End If
hope this helps
Regards
Jerzy
Back to top
View user's profile Send private message
JerzyPiotr
General User
General User


Joined: 03 Sep 2005
Posts: 32
Location: Poland

PostPosted: Wed Aug 06, 2008 4:41 am    Post subject: Reply with quote

JerzyPiotr wrote:
try something like this for each cell
Dim aURL As New com.sun.star.util.URL
aURL.Complete = oCellSource.getString()
dim oTransformer
oTransformer = CreateUnoService("com.sun.star.util.URLTransformer")
oTransformer.parseStrict(aURL)
'oTransformer.parseSmart(aURL,"")
If isUnoStruct(aURL) Then
'place result here
oCellDest = ThisComponent.Sheets.getByName("Arkusz2").getCellRangeByName("B9")
oCellDest.Formula = "=HYPERLINK(""" & aURL.Complete & """)"
End If
hope this helps
Regards
Jerzy
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