[Solved] How to add hyperlink in table of Base?

Discuss the database features
Post Reply
User avatar
ypersyntelykos
Posts: 107
Joined: Tue Jul 28, 2015 6:31 pm

[Solved] How to add hyperlink in table of Base?

Post by ypersyntelykos »

hello
i m new user
i m new user ( i was involved at the past in access database project )
but now im involve in a project in open office database

i try to find in table of base field type [hyperlink] but i dont find
and also how i get external data from excel table or other bases ??
please help
thanks
Last edited by ypersyntelykos on Mon Aug 03, 2015 7:59 pm, edited 1 time in total.
OpenOffice 4.1 + LibreOffice 5 on Windows Vista + XP
OpenOffice 4.1 + LibreOffice 5 on Linux mint 17,2
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: how to add hyperlink in table of base ??

Post by Villeroy »

Hyperlink fields are not built-in. I can offer a flexible macro solution which is supposed to work with common types of URLs and without editing the Python code after the code has been saved in a certain location.
Improved version of this stuff can be found here: viewtopic.php?f=100&t=92331&p=438435#p438435
This one still works well but is more difficult to set up.


1) Download the attached Base document
2) Copy the document to a trusted directory where macro execution is allowed according to Tools>Options>Security>[Macro Security]
3) Open the 2 tables. "Data" has a list of arbitrary file names in column "Files". In the Setup table you can specify a path for those file names where the "Name" is 'FilePath'. Column "Mail" has arbitrary mail addresses. Column WWW has various https: URLs related to this forum.
4) The query concatenates the file names with the given path from the Setup table and adds the mailto: protocol in order to get valid URLs.
5) The form named "URL Buttons" is based on that query. The form's "after record change" event is bound to the python macro.
6) The buttons are set up as hyperlink buttons (action="Open document/web page") with the corresponding field name as "additional info" property. The button names start with "URLButton" or with "FileButton". The latter variant converts a file path in system notation (C:\...) into a valid URL internally.

The WWW button opens the active record's https: URL in your browser and the Mail button should open your mail client with a new message to the current record's mail address. Any missing https:// prefix will be completed with a http:// prefix. This is done in by the query.
The macro disables any file button for any file that does not exist. If the file exists it will be opened with the respective default application for the file type.
If you want to use the Python macro with arbitrary database documents (which is what it is written for):
Unzip the Scripts/python/URLButton.py from this document and move the file to the Scripts/python/ subdirectory of your user profile folder.
[Tutorial] The OpenOffice User Profile
 Edit: 2015-09-06: Added improved query to allow for handle protocol prefix mailto: http: https: 
 Edit: 2016-02-18: Fixed error in http:// completion. Thanks to user dreamquartz 
 Edit: 2016-02-18: Embedded the Python code into the document and changed the above description accordingly 
Attachments
URLDatabase_PyEmbed.odb
(29.07 KiB) Downloaded 826 times
Last edited by Villeroy on Tue Feb 06, 2018 9:56 pm, edited 6 times in total.
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
User avatar
ypersyntelykos
Posts: 107
Joined: Tue Jul 28, 2015 6:31 pm

Re: How to add hyperlink in table of Base?

Post by ypersyntelykos »

Thanks for your answer
but this database install to in server so its not possible to go in every user
and install the code that you suggest
so the solution for me ( for multiusers in server) is this
OpenHyperlinks.odb
(13.27 KiB) Downloaded 1414 times
this data base have a button which open any object with the macro of course

thanks for your help
OpenOffice 4.1 + LibreOffice 5 on Windows Vista + XP
OpenOffice 4.1 + LibreOffice 5 on Linux mint 17,2
Post Reply