[Solved] Attach a text file to an odt file & export to PDF

Discuss the word processor
Post Reply
S0S
Posts: 5
Joined: Fri Jul 17, 2020 3:06 am

[Solved] Attach a text file to an odt file & export to PDF

Post by S0S »

OpenOffice Writer 4.1.7 on Windows 10

I am trying to attach a TEXT file into an ODT file, so that when the ODT is exported as a PDF, the TEXT file is attached within the PDF (just like one can attach a file using Adobe Acrobat), and have a link or icon to click that opens the attached text file. When the PDF is opened – and that link or icon is clicked, this should lead to the TEXT file opening in the Operating System's default text application.

The reason for this is that I am writing a beginner's help guide using OpenOffice Writer with the aim of the finished product being a stand-alone PDF file.

Everything is going well except for the issue of presenting Long Lines of code (spanning up to 5 lines) that the reader of the help guide will copy, and then paste at a Windows Command prompt. An Example of what needs to be pasted (actual code is much longer) is:

Code: Select all

C:> ProgramName.exe -Command01 -Command02  -Command03 -Command04 -Command05 -Command06 -Command07  -Command08  -Command09 -Command10 -Command11 -Command12 etc.
This needs to be one long line with no line breaks.

When the ODT is exported as a PDF – the text of long commands like above cannot be copied from the PDF without Line Breaks (a known issue with PDF files). So my thought is to attach a TEXT file that contains the Command Line code.

I have tried to embed the TEXT file by inserting it as an OLE Object, but have had no success.
I would appreciate some suggestions on how this can be done (without resorting to using Adobe Acrobat).
Last edited by Hagar Delest on Sun Jul 18, 2021 10:51 am, edited 2 times in total.
Reason: tagged solved.
OpenOffice 4.17 on Windows 10
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Attach a text file to an odt file, then exporting as a P

Post by Villeroy »

S0S wrote: The reason for this is that I am writing a beginner's help guide using OpenOffice Writer
S0S wrote:Everything is going well except for the issue of presenting Long Lines of code (spanning up to 5 lines) that the reader of the help guide will copy, and then paste at a Windows Command prompt.
How does that fit together?
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
S0S
Posts: 5
Joined: Fri Jul 17, 2020 3:06 am

Re: Attach a text file to an odt file, then exporting as a P

Post by S0S »

The "help guide" is being written "using OpenOffice Writer."
The guide is not about OO Writer.
I guess it fits together because - being a guide for beginners - I want to make it easy for the user - so copy and pasting should be accomplished simply.
That's the reason for attaching a text file - the user will find it easier to copy a very long line from a text file - than from a PDF where there will be lots of line breaks to remove (among other problems like lines breaking at hyphens that are part of the code - where the hyphens then disappear).
OpenOffice 4.17 on Windows 10
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Attach a text file to an odt file, then exporting as a P

Post by Villeroy »

Sorry, I did not get it right. PDF is a virtual print format. It simulates how characters, lines and areas are arranged on a sheet of paper. Apart from landscape orientation and a tiny font, I can not think of any way to print very long lines to a virtual paper sheet.

When I copy a long paragraph from Writer into a Linux terminal, I only get wrapping without any line breaks. The entrire paragraph is wrapped along the terminal borders but functionally it is one command line. I don't have Windows at hand right now.
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
S0S
Posts: 5
Joined: Fri Jul 17, 2020 3:06 am

Re: Attach text file to odt file, then exporting as a PDF

Post by S0S »

I believe I've found a better way to work around the issue.

I create a FORM and add a “Text Box”
I switch OFF Design Mode for FORMs
I paste the Long Line of code into the Form's Text Box
I switch ON Design Mode for FORMs
I give the Text Box the following properties (by double clicking it when editing is enabled):
General Tab:
Read Only → Yes
Text type → Multi-line
Small other changes – like the background colour, font size, etc.

When I "Export as PDF", in the “General” tab, I enable “Create PDF form”

In the PDF created, the multi-line text can be copied from the Form as one long line.
Works like a charm (so far) !!
OpenOffice 4.17 on Windows 10
Post Reply