[Dropped] Set default display font for TXT documents

Discuss the word processor
Locked
IanStar
Posts: 5
Joined: Thu Jan 18, 2024 6:11 pm

[Dropped] Set default display font for TXT documents

Post by IanStar »

 Edit: Split from Default font for text file because that topic more than ten years old, mostly a rant about OpernOffice, and in any case, you need your own topic. Please do not post in another's topic unless you are helping to solve their problem for them.
-- MrProgrammer, forum moderator  
Hagar Delest wrote: Tue Sep 23, 2014 10:01 pm I think that there is an import filter that applies the Preformatted text paragraph style to such file when opened in AOO.
So either select all and apply the Default style (you can use the Stylist for that), or save in native ODF (.odt), which is the recommended method of course.
I've got the same prob, with new docs opening in "preformatted text". How can I make it open in the default font I've selected? Or could you walk me through the solution above as I don't understand what you're referring to.
Thanks, Ian
Last edited by MrProgrammer on Mon Jun 30, 2025 8:49 pm, edited 1 time in total.
Reason: Dropped: Solutions provided; No reply from IanStar
OpenOffice 4.1.13
Windows 10 Pro
User avatar
MrProgrammer
Moderator
Posts: 5322
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Set default display font for TXT documents

Post by MrProgrammer »

IanStar wrote: Sat Jun 21, 2025 12:09 pm I've got the same prob, with new docs opening in "preformatted text".
I will guess that your new docs are plain text files, with a .txt extension, though you have not made that clear to us. My reply below is based on the assumption that your question is about TXT files.

It is important to understand that font is a concept which does not apply to a file in TXT format. Files like Foo.txt only contain characters. There is no place in a TXT file to store font information. However, you can open the file with Writer and have it displayed using the font of your choice. Just keep in mind that any formatting you perform in Writer is going to be lost if you save in TXT format, since only the characters are saved. To preserve formatting, save only in ODT format. You choose the file format in the File → Save As dialog.

IanStar wrote: Sat Jun 21, 2025 12:09 pm How can I make it open in the default font I've selected?
I found these answers in the ancient post, but buried in lots of ranting posts from another user who was eventually banned for violating forum policy. I've repeated those here to make them more easily available to you and others.
  • From keme: When you open a text file, it will be assigned the style "Preformatted text". What you need to do is to change the font for that style to Arial [or any other font of your choice] in an empty document. Save as a template, and set that file as the default template.

    File - Templates - Organize
    Select "My templates" in the left pane
    Command - Import template...
    Browse to the downloaded file and import it
    Select the template entry (you should find it below "My templates")
    Command - Set as default template
     
  • From Zizi64: Here is a macro example for opening a .TXT file and adjusting its properties
Styles are one of the most important features of Writer. If you want to use Writer effectively you must understand how styles work.
Writer Guide, Chapter 6: Introduction to Styles
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.6, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
User avatar
MrProgrammer
Moderator
Posts: 5322
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Set default display font for TXT documents

Post by MrProgrammer »

IanStar wrote: Sat Jun 21, 2025 12:09 pm How can I make it open in the default font I've selected?
Opening a TXT file applies the Preformatted Text style with the font set to Courier New. To change that font, first set option OpenOffice → Fonts → Font → Courier New → Replace with → Arial [or any other choice] → Click green check mark → ✓ Screen only → ✓ Apply replacement table → OK. Options are set with OpenOffice → Preferences on a Mac, Tools → Options on other platforms. Then open your TXT file and Writer should display the text with the font you set.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.6, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
IanStar
Posts: 5
Joined: Thu Jan 18, 2024 6:11 pm

Re: Set default display font for TXT documents

Post by IanStar »

Thanks, MrProgrammer.
Actually, what I'm doing is right clicking in a folder and selecting "new" then "open document text", which opens a new ODT file. I found a workaround regarding the "preformatted text" by using ctrl+0 each time to set the style to "text body" which uses my chosen font (verdana). Unfortunately I have to do that every time though. But on top of that, each time I open the document, I get the "ASCII Filter Options" dialogue box open, which is just as annoying.
Anyway, I shall look into the "default template" option you describe. That looks like the solution I'm looking for.
Thanks, Ian
Windows 10 pro

EDIT: Nah, the "default template" method doesn't change the result when I "right click in a folder" for a new document.
OpenOffice 4.1.13
Windows 10 Pro
User avatar
MrProgrammer
Moderator
Posts: 5322
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Set default display font for TXT documents

Post by MrProgrammer »

IanStar wrote: Mon Jun 23, 2025 11:15 am Actually, what I'm doing is right clicking in a folder and selecting "new" then "open document text", which opens a new ODT file.
Now I am really confused. The ancient topic in which you created a new post concerned opening files saved in the plain text TXT format. But now you say what you are doing is completely different. You are using a right-click in a folder in the Windows file manager and having Windows (not OpenOffice) create a new file. I, thankfully, do not use Windows but several topics on the forum say that the template which Windows uses for a new ODT file is not related to the templates that OpenOffice uses or the templates you might create in Writer. I will let someone who uses Windows explain more, or you can perhaps find some of those topics via the search box in the upper right corner of forum pages. If you want to use an OpenOffice template to create a new file, right-click → New is the wrong approach. If files are created incorrectly with right-click → New, that is a Windows problem.

In OpenOffice use File → New → Text document. Create or modify styles with the attributes that you want. For example, you can modify the style for Preformatted text to set the font type and size. Then save the empty Writer document as a template with File → Save As → File type → ODF text document template (.ott) in a convenient folder, say the desktop. It will be helpful to give it name containing the word template. You only need to perform these actions once.

To create a new Writer document using your template, open it either from OpenOffice or by double-clicking the template file in Windows. This will create a new empty Writer document containing the styles you put in the template. It will have the name Untitled.odt. You can edit and then save the new Writer document, giving it an appropriate name. Put text in the new, empty Writer document either:
• by typing it, or
• by copying text to the clipboard and using Edit → Paste Special → Unformatted text, or
• by using Insert → File to load the entire content of another file on your computer.
The template was only used to create the empty document and is not changed when you save the new document. As long as you save the file as the recommended file type ODF Text document (.odt), everything is preserved. Saving in other formats risks the loss of data, formatting, or features. Always enable the checkbox Automatic file name extension.

IanStar wrote: Mon Jun 23, 2025 11:15 am Each time I open the document, I get the "ASCII Filter Options" dialogue box open, which is just as annoying.
You should definitely not get an ASCII Filter Options dialog when you open a Writer document saved in the ODT format. Explain fully what you are doing to create files which open with that dialog. If you need to work with plain text files and are saving documents as plain text using File → Save As → Text (.txt), Writer is probably not a good choice for this work. Writer is intended for use with modern text documents which can contain sophisticated features: fonts, intendations, alignment, headings, tables, numbered lists, cross references, footnotes, etc. For working with plain text documents that do not contain those features a web search will find many tools for you. Every operating system comes with one or more pre-installed tools for plain text files, or you may prefer others. I do not use Windows and offer no recommentations for that environment. People using MacOSX would use the pre-installed TextEdit program.

You can open a plain text document with Writer, but those types of files contain nothing but characters. There is no formatting information in them. Writer has no idea what font had been set before you used Save As → Text (.txt), since font information can't be saved in TXT files, so you will get a default font when you open the saved TXT file because Writer must know the font for every piece of text. Also, plain text files can be created with many different types of characters and encodings. This is discussed in the plain text link I provided earlier. Because Writer doesn't know what characters or encodings were used to create your plain text file, it has to ask you for that information. This is one of the reasons you should consider a different tool, not Writer, if you are working with a lot of plain text files.

If you are using the wrong program for your work and are finding it difficult to use, this is like the person who finds it hard to drive screws with a hammer. I decline to help people who want to use the wrong tool for their work.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.6, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
John_Ha
Volunteer
Posts: 9600
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Set default display font for TXT documents

Post by John_Ha »

If you are saving your work as .TXT files there is no point in using Writer - you will be better sticking with Notepad.

Why?

Because Writer provides a vast number of formatting options. If you use any of them, they will be lost when you save as a .TXT file. You are better to use Notepad which only gives options which can be saved in .TXT files.

See the tutorial on the difference between Microsoft and OpenOffice files for a discussion of different file formats. No two different file formats (.doc, .docx, .rtf, .wps, .odt, .txt etc) are identical - each has significant differences to the others.

In my opinion, Writer's ability to open and save .TXT files is merely a convenience for anyone not having Notepad to hand.
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
floris v
Volunteer
Posts: 4577
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

Re: Set default display font for TXT documents

Post by floris v »

There is a feature in Apache OpenOffice that allows you to "create" a new Writer document from a popup menu in Windows File Explorer. As Mr Programmer pointed out, that feature uses a default template that is not related to the default template in OpenOffice, it is in fact quite flawed and disables, for instance, setting a language for the document (or parts of it) for spell checking. This problem has been brought up quite a few times by people having trouble with spell checking. Don't use this method to start new Writer documents if you don't want to lose your sanity. Starting OpenOffice and starting a new document once it's open is not more work, it's just different. If you really work with plain unformatted ASCII text, don't need to use Writer at all (except perhaps for spell checking and then your method fails anyway).
LibreOffice 24.2.7.2 on Ubuntu Linux
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
Locked