[Solved] Accessing URL in Calc cell

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
MikeV
Posts: 2
Joined: Wed Jul 31, 2013 8:28 pm

[Solved] Accessing URL in Calc cell

Post by MikeV »

I'm linking a spreadsheet to a web page which pulls in a hyperlink and pastes it into a cell. The cell displays text on a grey background. If I float the cursor over the text it displays the hyperlink URL. However, even using MRI on the cell object in a Basic macro, I can't find where the URL is stored so that I can access it as a string.

Any pointers or a code snippet would be much appreciated!
Last edited by MikeV on Wed Jul 31, 2013 10:57 pm, edited 1 time in total.
LibreOffice 3.6.2.2 on LinuxMint 14
B Marcelly
Volunteer
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area

Re: Accessing URL in Calc cell

Post by B Marcelly »

Upload a sample document as attachment, so that we can see what is in your cell.
Bernard

OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Accessing URL in Calc cell

Post by Villeroy »

Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
MikeV
Posts: 2
Joined: Wed Jul 31, 2013 8:28 pm

Re: [SOLVED] Accessing URL in Calc cell

Post by MikeV »

Thanks Villeroy! That's just what I need.

Note to anyone looking to extract the same URL string: The CELL_URL function linked to by Villeroy does the job and does lots of checking of parameters before delivering the wanted URL string. The key line, which works for me, is:
URLString = CellObject.Textfields.getByIndex(0).URL
I'm still quite new to Macro programming in LibreOffice but I don't think I don't think I'd of found that syntax any other way.
LibreOffice 3.6.2.2 on LinuxMint 14
Post Reply