Ask Your Question

Opening an external file in LibreOffice Base

asked 2018-06-18 13:56:13 +0100

szdr gravatar image

updated 2018-06-18 23:23:21 +0100

peterwt gravatar image

I'm trying to build a database containing records for the employees of the company. Each employee is a unique entry with all the relevant data. However, I want to open the CV of each employee directly from the form. I tried using a push button, but it opens the same file for all records and I want each record to have a unique PDF file attached to it. I don't want to embed the PDFs because that would make the database too big.

I suspect that I can use macro for that, but I have no idea how to use or where to download macros from. I'm using Libreoffice

Any help will be appreciated.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-06-18 17:02:52 +0100

Ratslinger gravatar image


You do not specify what database you are using. Be aware, if using the default HSQLDB v1.8 embedded database, this is being replaced by Firebird 3 DB which is newer and has much more capabilities.

Regardless, you can open .pdf files directly in a form, without macros, by using an image control. It is your choice whether it is an embedded or linked image but linked, as you state wanted anyway, is certainly the way to go.

You can also open .pdf files (or other documents, web pages etc) as you noted, from a push button but a macro is needed. Macros are NOT universal. They need to be fitted the the controls and situation in each instance. You can take an existing macro and modify it to your needs. For this macro, see my answer on this post -> In base how to open a URL field?. For more information on macros in LO see the documentation found here -> Documentation/Publications.

Please note it is always preferable to do without macros if possible.

edit flag offensive delete link more


Thank you, but the problem with linking PDF in that way is that an image of the PDF is shown in the image control button but when I double click, it opens the folder of the pdf, not the pdf itself.

I'm using the default Database for Libreoffice Base which I believe is HSQLDB.

szdr gravatar imageszdr ( 2018-06-19 16:30:41 +0100 )edit

As stated in last paragraph of answer, you can open the actual document using a button but it needs a macro (link to sample is there also). It will need to be modified to your form/control names.

There is nothing about opening the actual document by double clicking the image control. That is only to set the image.

Ratslinger gravatar imageRatslinger ( 2018-06-19 18:15:26 +0100 )edit

You can attach a macro to the click event also.

Xoristzatziki gravatar imageXoristzatziki ( 2018-06-20 07:08:52 +0100 )edit

Thanks to both of you. I manage to figure out the macros and adapted the one that Ratslinger gives in his other answer. Now it works like a charm!

szdr gravatar imageszdr ( 2018-06-20 15:38:15 +0100 )edit

@szdr Glad you got what you wanted.

As you have been helped, please help others to know the question has been answered by clicking on the ✔ in upper left area of answer which satisfied the question.

Ratslinger gravatar imageRatslinger ( 2018-06-20 16:17:43 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-06-18 13:56:13 +0100

Seen: 519 times

Last updated: Jun 18 '18