[Solved] Default font and margin for opening text files

Discuss the word processor
Post Reply
georgewf
Posts: 5
Joined: Sun Jun 01, 2008 6:38 pm

[Solved] Default font and margin for opening text files

Post by georgewf »

Hi,

How can we set the default font and margins when opening a .TXT file?

I have tried setting the default template but this template is not applied when we open a text file.

Thanks
George
Last edited by Hagar Delest on Mon Jun 09, 2008 5:34 pm, edited 2 times in total.
Reason: tagged the thread as Solved.
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: default font and margin for opening text files

Post by acknak »

A text file has no formatting, including no margin settings, so in that sense, it's not surprising that the template settings have no effect. On the other hand, Writer must give the opened document margins from somewhere, why not from the default template?

However, no matter what margins are set, they won't be saved in the file, because a text file has no way to record such a setting.

What specifically are you trying to accomplish?
 Edit:  
Just to verify, I see the same thing: opening a text file uses the built-in default template, not the user-specified default template.
Seems surprising to me, although as I said, I don't see how it matters much.
AOO4/LO5 • Linux • Fedora 23
georgewf
Posts: 5
Joined: Sun Jun 01, 2008 6:38 pm

Re: default font and margin for opening text files

Post by georgewf »

Thanks for your reply.

What I am doing is generating text files from an order-processing system and viewing them in Writer. I can give the order form or purchase order a quick review and then from Writer I have my choice of emailing the file as a PDF or text file, or cut-and-paste into an email.

Some of my text files are a bit too wide for the default Writer margins and font size so the text wraps.
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: default font and margin for opening text files

Post by acknak »

You may want to simply use a text editor for that. Most of them will allow you to set the font, character size, and line-wrapping that are used, and it will be far faster than starting Writer.

If you still want to use Writer for some reason, you can get what you want by, instead of File > Open report.txt, use File > New > Text Document, then Insert > File report.txt.

That will use the default template, which you can set to use whatever page layout and text style you want. Note that you'll need to modify the paragraph style named "Default", saved in your template, if you want to change the text appearance.

If you use Writer for other documents, you probably don't want to make this the default template. Just create your template, but don't make it the default. Then you can open your report text using File > New > Templates and Documents, select your template, then insert the text file.

Hmm, that's still a lot of hassle. In this case, you don't really need a template at all. Just make an empty document with your layout and settings, open that normally, then insert the text file. That way, the empty document will be in the File > Recent Documents list, and it will be a cinch to go back to it.
 Edit:  
PS: Another approach that's even faster is to open the blank Writer document, then drag the text file in from the file manager. Writer will insert the file as a separate section, and apply the style "Preformatted Text" to it. Whatever you set for that style will apply to the inserted text.
AOO4/LO5 • Linux • Fedora 23
georgewf
Posts: 5
Joined: Sun Jun 01, 2008 6:38 pm

Re: default font and margin for opening text files

Post by georgewf »

If there is a command-line switch to choose a template that would work, because I create the temporary text files from my order system and then call the Windows default text editor to view the file. I could easily add something like /template=100cols

Or, if there was a simple file format where I could specify a few formatting commands at the top of the file, followed by text. I spent too long today trying to figure out how to create XML files, and in the end OO just opens the raw xml data. I could create RTF or XML or anything - whatever is easiest without having to totally rewrite all my order forms, invoices, reports, and purchase orders.
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: default font and margin for opening text files

Post by acknak »

Sounds to me like you just need to find a decent text editor. That's all you need and you should be able to configure the display settings without further nonsense.
AOO4/LO5 • Linux • Fedora 23
georgewf
Posts: 5
Joined: Sun Jun 01, 2008 6:38 pm

Re: default font and margin for opening text files

Post by georgewf »

This extension helps a lot:

http://extensions.services.openoffice.o ... atechanger

Just 2 clicks to assign a new template.
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: default font and margin for opening text files

Post by acknak »

Hmm... It seems I still don't understand what you're doing: how does that help?

Oh, wait, you mean you can open the report (text) file, then use the template changer to switch to a special "report viewing" template? Ok, that makes sense now.

Nice, thanks for the follow-up.
AOO4/LO5 • Linux • Fedora 23
georgewf
Posts: 5
Joined: Sun Jun 01, 2008 6:38 pm

Re: [Solved] Default font and margin for opening text files

Post by georgewf »

Yes this template changer makes more sense since I do have some landscape reports etc...

Continuing this thought... templatechanger runs a macro... can I embed macros into a file to autorun?
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Solved] Default font and margin for opening text files

Post by acknak »

I'm fairly sure you can run a macro when the document is loaded, but you'll need to ask on the macros forum to get a good answer.
AOO4/LO5 • Linux • Fedora 23
Post Reply