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

Joined: 05 May 2007 Posts: 8
|
Posted: Mon Jul 28, 2008 8:33 pm Post subject: text to hyperlink in calc |
|
|
| 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 |
|
 |
JerzyPiotr General User

Joined: 03 Sep 2005 Posts: 32 Location: Poland
|
Posted: Mon Jul 28, 2008 10:53 pm Post subject: |
|
|
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 |
|
 |
JerzyPiotr General User

Joined: 03 Sep 2005 Posts: 32 Location: Poland
|
Posted: Wed Aug 06, 2008 4:41 am Post subject: |
|
|
| 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 |
|
 |
|