Libre Writer - Opening plain text documents to desired font

Hi Folks,

I'm new to Libre Office but I read how you can create your own default
font style and size so a blank document will open to that default
style and size.

I'm trying to set Libre Writer so that when I open a saved plain text
(.txt) file it opens to my created default style and size.

Right now it opens to Preformatted Text - Courier New 10 point.

I've visited Styles and Formatting and right clicked on Preformatted
Text and chosen Modify and changes the font to Bookman Old 12 point
and clicked Apply, then OK.

I then reopened Preformatted Text style and it indeed displays my
chosen font and size.

However, still when I open a saved plain text file it opens to
Preformatted Text but with Courier New 10 point - not the Bookman Old
12 point I chose and saved.

Would anyone know if you can open saved plain documents to a desired
font style and size or are you always stuck with Courier New 10 point
whenever you open a plain text file?

I know I can highlight all the text in the opened plain text file and
chosoe the Default style and it will change back to my desired font
and style but is there any way of ensuring any plain text files will
open to a desired font stye?

Thank you so much,

Charles.

Hi :slight_smile:
I think you don't even have to select all your text.  Just have the cursor somewhere in the text and click on the box besides the fonts box on the toolbar and reselect default (or whatever) i think that should be enough to reassert your fonts and sizes rather than copying the ones used in your text-editor.

My text editor doesn't use Courier so i get Arial or something when i try to copy&paste from it. 
Regards from
Tom :slight_smile:

I do not remember that you can save a font style and such in a plain text file.

How did you set up the "Styles and Formatting" to open plain text files to Bookman Old? I do not remember how this is done or if it can be done for the "default" font used on opening a specific mime-type file for .txt or such.

my 3.5.7 - 64-bit DEBs install gives me:

    save as "text" - DejaVu Sans Mono

    save as "text encoded" - Times New Roman - which was the font that
    it was in when I saved the document.

So "Text Encoded" should keep the text font/style you used for the document and save it as a ".txt" mime type or file extension type.

.

Hi Tom,

Have you figured out if Libre Writer can open plain text files
automatically to your chosen font?

When I place the cursor anywhere in the body of the text of a plain
text file and then choose Default in the style window it only changes
that line of text to my chosen Default style, not the whole file of
text.

What version of Libre are you using?

Thank you,

Charles.

AFAIK *.txt do not store any complex formating information beyond what is found in the character set (UTF-8 typically). Thus tabs, carriage returns, line feeds are encoded; they are part of the character set. Bold, italic, font, size are not part of the character set; thus are not encoded. When you open a txt file, it appears to open using the mono space font set as your system default (mine is "Droid Sans Mono", 10 point). Typically, text editors use mono space fonts so that each character/space has the same width which makes "eyeballing" the layout for source code easier when indenting. *txt files are also called "plain text" files because that is what they are just plain text.

After formating the text, I would save as the file as *.odt (and *.doc if sharing) formats to preserve the desired formating.

As I said in my post, USE "Text Encoded" and your .txt file will save the font and the style of font in the file. Plain "TEXT" does not., Encoded Text [Text Encoded] does.

Text - opened with the fixed width - i.e. MONO - font, but saving as Text Encoded kept the Times New Roman font formatting from the original document when I opened it. The issue for me is that both formats use the same mime/file-extension type of ".txt".

TEXT ENCODED is the answer. Save it in that file format and it solves the problem.

If you have plain text, use Control+A to highlight the entire text. Then clicking the Default Paragraph style will change to your desired font.
      The key to what is happening is the type of style being applied: paragraph. If you place the cursor in a single line paragraph, clicking Default will only change one line. If a paragraph has several lines, doing this will change several lines.
      Stop and think about your question. If Writer were to do what you wanted, it would do this for all text files. That means you might later create a text document with several custom styles in it. Opening this document in Writer would remove all these styles. This is not a good idea.
      However, there is a better way to do this using copy and paste special. Open the text in a simple text editor (Notepad, Gedit, etc.) Open Writer with an Untitled document. Click your Default style so that it is applied to the first paragraph (empty paragraph in this case. Copy the text. Paste special (Control+Shift+V). Select Unformatted text. All the text will be pasted with your default font.

--Dan

Hi :slight_smile:
Ahhh, thanks Dan.  That makes more sense.  Sorry Charles, ignore me.
Regards from
Tom :slight_smile:

Menu/Insert/File set the style in use where the file text is inserted.

So creating a new writer file and inserting the file, must assign the default format.

If you're saying you wish to use a different font for your default
font, then just go to 'properties'
           --> scroll through the folder-files to change the set defaults
to those you desire
                 --> save your changes.
       There's a setting for documents you make as well as documents you
receive; font colour may also be chosen.

Hi Folks,

I don't think that there is a way to do this. The answers so far have been workarounds. (It's not clear whether their authors were aware of that.) You are not talking about inserting a file into an existing document or pasting text into an existing document but about opening a plain text file in LibreOffice (Writer) - either through File | Open... or using Open With > (or similar) in your operating system. You would then, after editing, presumably save this as a (formatted) .odt document.

There are two issues here, I think. In order to change the Preformatted Text paragraph style you have to have a document open - and the change is made to the style in that document, not in your installation of LibreOffice. So your change is ignored when you open the new document from your plain text file. The way around that might seem to be to create a template containing your modified Preformatted Text paragraph style and then to set that as the default template. You can certainly do that. Now you would probably expect in this case that when you open your plain text file the new text (Writer) document would be created from your new modified default template, but - perhaps perversely - it appears to be opened using the original "default" default template, ignoring your desired change.

I trust this helps (though I doubt it does).

Brian Barker

I think you've missed the point here. The questioner is asking about opening *plain* text files. Yes: he wants to control the automatic paragraph style which Writer chooses for all plain text files opened in this way. The text files containing custom styles that you are describing are formatted text (Writer) files - probably in .odt format. (No doubt he will save his new documents in that format after he has edited them.) Opening such .odt documents does not impose Preformatted Text paragraph style on anything, of course.

Brian Barker

Perhaps I did miss the point. So, here is another thought. Open the desired template which creates an untitled document with its styles. Then Insert > File. Browse to the text document. Click Open. In my case, the plain text was formatted with the desired format.
       There must be a difference of how LO handles a text file when it opens it vs when it inserts it.

--Dan