Opening an external file in LibreOffice Base

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 6.0.4.2

Any help will be appreciated.

Hello,

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.

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.

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.

You can attach a macro to the click event also.

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 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 :heavy_check_mark: in upper left area of answer which satisfied the question.