[Solved] Updating external link data

Creating a macro - Writing a Script - Using the API

[Solved] Updating external link data

Postby gurkand » Thu Aug 29, 2019 2:02 pm

Hi All,
My Calc workbook has links to external data and after "Enabling" these connections, some of them fail to update. When I notice the failed ones, I have to update that specific one manually.
How can I do this within the script (LibreOffice Basic) that I am already running for manipulating the data afterwards?
ie. if Cell is "" Then <reload/update that specific link>
Is there a command that I can use in this kind of a logic?
Thanks in advance.
Last edited by gurkand on Fri Sep 13, 2019 7:14 pm, edited 1 time in total.
LibreOffice 6.3
gurkand
 
Posts: 29
Joined: Wed Feb 28, 2018 10:27 am

Re: Updating external link data

Postby JeJe » Thu Aug 29, 2019 3:38 pm

macro for updating all links here:

viewtopic.php?f=20&t=6004#p28037
Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 585
Joined: Wed Mar 09, 2016 2:40 pm

Re: Updating external link data

Postby gurkand » Thu Sep 12, 2019 8:13 pm

Hello All,

I am trying to update the 4th link as seen in the list of links.jpg.

The macro I wrote for this, and the error message when I try to run are also attached as the error message.jpg.

Any help for this, please?

Thanks in advance.
Attachments
error message.jpg
error message.jpg (38.35 KiB) Viewed 260 times
list of links.jpg
LibreOffice 6.3
gurkand
 
Posts: 29
Joined: Wed Feb 28, 2018 10:27 am

Re: Updating external link data

Postby UnklDonald418 » Fri Sep 13, 2019 6:53 am

Since the error message indicates there are fewer than 5 links on your spreadsheet, try adding 2 lines to help with debugging.
Immediately after defining oDocument add
Code: Select all   Expand viewCollapse view
print oDocument.Title
print oDocument.SheetLinks.Count

The first to verify that oDocument is referring to the correct document.
The second to determine how many links the document supposedly has.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.6 & LibreOffice 6.1.5.2 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 1225
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Updating external link data

Postby Villeroy » Fri Sep 13, 2019 7:55 am

The html links in the screen shot aren't SheetLinks. These are AreaLinks.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27226
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Updating external link data

Postby gurkand » Fri Sep 13, 2019 7:14 pm

Many thanks for your help.

It is working now.

If you could tell me where I can I find the options that are avail like AreaLinks / getbyIndex() / refresh() I will appreciate that.
LibreOffice 6.3
gurkand
 
Posts: 29
Joined: Wed Feb 28, 2018 10:27 am

Re: [Solved] Updating external link data

Postby Villeroy » Fri Sep 13, 2019 7:39 pm

In the API documentation and with the help of MRI or any other object inspector.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27226
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [Solved] Updating external link data

Postby JeJe » Fri Sep 13, 2019 9:06 pm

What I do is type in OpenOffice plus the search word into a search engine.

OpenOffice AreaLinks second result is this page which has the relevent links to the OpenOffice API reference:

https://wiki.openoffice.org/wiki/Docume ... Area_Links

You'll often find someone has had the problem before and there'll be a thread like this one - which you can also find in the search box at the top of the page.
Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 585
Joined: Wed Mar 09, 2016 2:40 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 5 guests