Opening text docs in OpenOffice

Discuss the word processor
Post Reply
coppens1
Posts: 46
Joined: Fri Oct 22, 2010 4:26 pm

Opening text docs in OpenOffice

Post by coppens1 »

OpenOffice Support 031118 Opening text docs in Open Office

Deqr fellow Open Office Users, I often prepare and save documents using Microsoft Notepad, because of the minimal storage used.

But when I print, I often open the .txt documents in Open Office. EAch time I have to adjust the margins from the default of .79 inches to .3 inches using the format page function.

I tried to eliminate that by changing my 'untitled 1' template so that the default margins are all .3 inches. Now when I initiate Open Office text documents I get a .3 margin. But when I open documents saved as .txt documents, the margins still appear as .79.

How can I change Open Office so it will open .txt documents with the desired .3 margins?

Thanks, JC
OpenOffice 3.1 on Windows XP
User avatar
RoryOF
Moderator
Posts: 34618
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Opening text docs in Open Office

Post by RoryOF »

What happens if, instead of opening your text document directly in OO, you start a blank document in Writer, then /insert /File /Your_text_document.txt?
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
coppens1
Posts: 46
Joined: Fri Oct 22, 2010 4:26 pm

Re: Opening text docs in Open Office

Post by coppens1 »

I haven't tried that, because it is an extra step. But I assume since I am pasting into a document with .3 margins, it will stay at .3. I will try it and get back to you. JC
OpenOffice 3.1 on Windows XP
User avatar
Lupp
Volunteer
Posts: 3553
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Opening text docs in OpenOffice

Post by Lupp »

As far as I know (not knowing the reasons): When opening plain-text-files with Writer always the original 'Default' template is used, not the standard template you may have created. As a rule you cannot edit the 'Default'.

But:
OpenOffice is capable of importing styles from other documents and of overwriting the previously defined styles with the imported ones having the respective names (same category, of course).
It is simple to create a template with the few style definitions you need: 'Default' page style and 'Preformatted Text' paragraph style as a minimum. You then can load these styles into the already opened plain-text-document and overwrite the existing used styles by them. However, I don't know the menu path for doing it manually in AOO. (In recent LibO it's placed near to the surface: > Styles > Load Styles....) But anyway it may not be a great advantage concerning time expense as compared with directly setting the margins anew every time.

If you need this really often, you can create a "macro" module in your local MyMacros.Standard library and probably connect the relevant macro to an additional /text/icon/ sensitive area in a toolbar.

If you are badly pressed I can advise you concerning the macro.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Opening text docs in OpenOffice

Post by John_Ha »

A standard Notepad .txt file stores only text characters. It does not store any margin settings.

If you set margins in Notepad, the margin settings are stored in the Notepad application and not the .txt file you are editing. The margin settings are only used for printing.

1. I created fred.txt using Notepad.

2. I started Writer and an empty page appeared with page margins. I went File > Open ..., and navigated to fred.txt.

The content in fred.txt was brought into Writer using Writer the page margins.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
User avatar
Lupp
Volunteer
Posts: 3553
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Opening text docs in OpenOffice

Post by Lupp »

John_H wrote:A standard Notepad .txt file stores only text characters. It does not store any margin settings.
Yes. And no font information, nothimg about indentation and/or tabs...

That should be the reason for what Writer, when used to open such a file, places the text into a new (still unsaved) document made from the 'Default' template. In addition the paragraph style 'Preformatted Text' is applied. Presumably Writer treats plain text this way because this paragraph style is supposed to have "zero formatting" and a monotype font.
Writer simply cannot treat plain text as just plain text. It always has to apply a style necessarily. It only can use the "least stylish" one per category.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
coppens1
Posts: 46
Joined: Fri Oct 22, 2010 4:26 pm

Re: Opening text docs in OpenOffice

Post by coppens1 »

Rory 041118 Open Text Docs in Open Office
Dear Rory, as I suspected, if I do the extra step, I can obtain an Open Office copy of my text document with .3 margins. The disadvantage is having to open two documents and copy from one to the other.

I don't understand why, if my 'Untitled 1' default start document in Open Office has .3 margins, why, when I open a txt document using 'open with' and select 'Open Office Writer' it opens with .79 margins.

Why doesn't the system use my default Open Office document with .3 margins? JC
OpenOffice 3.1 on Windows XP
coppens1
Posts: 46
Joined: Fri Oct 22, 2010 4:26 pm

Re: Opening text docs in OpenOffice Lupp

Post by coppens1 »

Dear Lupp,
Lupp » Sat Nov 03, 2018 11:14 pm

"As far as I know (not knowing the reasons): When opening plain-text-files with Writer always the original 'Default' template is used, not the standard template you may have created. As a rule you cannot edit the 'Default'......
If you need this really often, you can create a "macro" module in your local MyMacros.Standard library and probably connect the relevant macro to an additional /text/icon/ sensitive area in a toolbar.
If you are badly pressed I can advise you concerning the macro."

I think you are right, the Writer is using the original "default template". Yes, I do it often enough that a macro would be helpful so I can get the .3 margins. How do I go about doing the macro? JC
OpenOffice 3.1 on Windows XP
User avatar
Lupp
Volunteer
Posts: 3553
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Opening text docs in OpenOffice

Post by Lupp »

justForTest.ott
(10.31 KiB) Downloaded 118 times
A roughly sketched macro and a little helper function for the purpose are contained as text -not in a macro module- in this attached plain-text file:
manualCSV.text.csv.txt
(1.81 KiB) Downloaded 123 times
The template which I used for testing you find here:
justForTest.ott
(10.31 KiB) Downloaded 118 times
To get things work you need to
-1- copy the macros, create a module in your 'MyMacros.Sztandard' library and paste the macrois in.
-2- save the template (or a better one you created yourself) at a known place in your file system, probably in the folder 'template' of your user profile. Better: Import it to your templates with the template manager.
-3- replace the string assigned to templateFN in the macro with the actual pathname of the template on your system.

Now you can open a plain text file (the attached example e.g.) with one of the extensions 'txt' or 'text' or 'csv' and go > Tools > Macros > Run > select the macro > OK.

-4- If you decide to use the macro on a regular basis, you may insert a link to it into a toolbar via > Tools > Customise.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
coppens1
Posts: 46
Joined: Fri Oct 22, 2010 4:26 pm

Re: Opening text docs in OpenOffice

Post by coppens1 »

Dear Lupp, Thansk for your response.

Is the justForTest.ott file an Open Office file? I haven't used .ott files. I am in the library, and it won't open here. I will try it at home with Open Office. JC
OpenOffice 3.1 on Windows XP
User avatar
robleyd
Moderator
Posts: 5085
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Opening text docs in OpenOffice

Post by robleyd »

.ott is a Writer template file.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
Post Reply