I’d like to insert a file into a LO writer doc, so that people can double click it, and it opens (so NOT the contents of the file, literally an icon of the file, and that the file is stored with the LO writer file, so that people to whom I send the LO writer doc can double click the icon and open the inserted file).
does anyone know if this is possible?
What you want to do is called an hyperlink. But this only covers partially your requirement.
You insert a hyperlink with
Hyperlink. In the dialog which pops up, click on the Document icon. Selct the linked document by clicking on the file browser icon (looking like a folder). A URL in the form file:///… will be entered in the Path box. Enter a descriptive text in Text box. This text will be displayed instead of the URL.
Send both your document and the linked file as it will not be stored inside the document.
There is however a big caveat: the URL gives the absolute path to the linked document. As a consequence, if your recipient does not store the sent material under the same path, Ctrl+click or double-click will not work.
(Also, OS name and LO version would have been useful.)
EDIT: Solution based on Section
To keep everything inside a single document, the alternate file can be insert as
Text from File inside a section. This section is conditionally hidden depending on the value of a variable. In the section properties, tick the Hide box and enter
v==0 in the With Condition line.
v is the variable name, choose any fitting your taste. I use an “inverted” condition
v==0 because a section is hidden when the condition is true and we, as human, prefer to consider true for display.
Where you would put your prompt for the alternate document,
Variables tab, Set Variable Type for the variable.
Since the procedure to “reveal” the hidden text is not obvious at all, the prompt should explain it: double click on the variable field (enable
Field Shading to make the field more visible) and change the value from 0 to 1 (and vice versa to hide the section).
thanks yes precisely, for this reason (and also because it is easier to just sent 1 file) i don’t want to add a hyperlink, but i want to insert the actual file (I remember this being possible, but that may have been when I was still working on MS Word)
sorry am on Kubuntu 22.04
It is possible to put additional files inside the .odt-file, as it is actually a zip-archive. I don’t know of a possibility to set a hyperlink to a destination inside this zip-Container. However a solution via macro may be possible, but requires consent of the receiver to use macros.
PDF allows this feature (embedded sub-files) also, but actually I know of this only as being a security issue…
You can in Word so you can in Writer:
- Place your cursor in your document where you want the icon to appear.
- Click Insert > OLE Object > OLE Object.
- In the dialogue that opens click the option button Create from file.
- In the new dialogue box click the Search button to navigate to and select your file. Select the option Display as icon and OK.
EmbedOLE-ObjectsAsIcons.odt (54.6 KB)
thanks this is very helpful.
I tried this and it works, even when the source file is moved - so the inserted file really appears to be embedded in the file in which it is inserted.
Still need to test if it also opens on another PC.
However, one thing i noted: the file cannot be opened if the document is exported as a pdf. It would be super convenient is this would be possible. Is there a setting I can toggle for the pdf exports to make this happen? Or any other way in which this can be done?
LibreOffice embeds files using OLE; PDF uses a different technology. There is no conversion from one to another.
You could file an enhancement request to implement such a conversion for one single kind of an embedded object.
A read-only Writer document should be just as good as a PDF since the reader of the embedding document is using an ODF capable reader. menu:File>Properties… tab “Security” adds a read-only flag to the embedded document with an optional password.
Seems to be Bug 35289 - Libreoffice does not attach OLE objects when exporting to pdf
That bug is still unconfirmed however, apparently due to a misunderstanding.