Solved: How do you give plain text files a default?

Discuss the word processor

Solved: How do you give plain text files a default?

Postby cobbhen » Thu Jun 14, 2018 10:36 pm

One of the uses I have found for OO is as an editor for assembly language programs. The source file must be a "clean" text file ... i.e no embedded format control characters. I have figured out what font(s), tab settings, etc. I need to use in order to obtain a display (and listing) of the source file that is "field aligned" vertically (this really helps when you attempting to debug a program, using the source listing. The problem I'm running in to is that when I open a source code file (right now, I'm using .txt extension) OO defaults to "Preformatted text". I must then go through the procedure of selecting the entire text and clicking on the "default" format selection. When I'm done with file, it is saved. I have to go through this procedure each time I open the file.

Is there a way to (template, etc.) to make OO "remember" what the format needs to be so I can avoid these steps?

Thanks,
--HCC
Last edited by cobbhen on Fri Sep 07, 2018 10:28 pm, edited 1 time in total.
OpenOffice 4.1.4
Win7 SP1
cobbhen
 
Posts: 2
Joined: Thu Jun 14, 2018 10:05 pm

Re: How do you give plain text files a default opening forma

Postby RoryOF » Thu Jun 14, 2018 10:42 pm

Yes, you can set a default template, with default styles. See
[Tutorial] Creating a new default template

but, to be frank, I think you would be better choosing either a programming editor or an IDE. Which to choose? I cannot advise, as I do very little programming now.
Apache OpenOffice 4.1.5 on Xubuntu 18.04 (mostly 64 bit version) and infrequently on Win2K/XP
14 October 2016 was Pooh's 90th birthday
User avatar
RoryOF
Moderator
 
Posts: 27182
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: How do you give plain text files a default opening forma

Postby John_Ha » Fri Jun 15, 2018 11:16 am

A .txt file is a flat ASCII file containing only characters - it does not (and cannot) save any formatting information - not even the font or font size.

Clipboard02.gif
test.txt file containing abcde opened in a Hex editor

You must save the file as a .odt to keep any formatting.

You could record a macro which selects All and formats it. Place an icon for the macro on the toolbar. Open a .TXT file and click the icon - all done in one click and it still leaves AOO as standard for other uses.

You would be much better using a proper software editor (google for options) which lays out the language you are using. Have a look at Notepad++ where you can use pre-defined formats or define your own. It does useful things like automatic indenting, identifying matching start and end tags in XML, pretty printing XML, finding matching start and end brackets etc.

Clipboard03.gif

Clipboard01.gif

Showing that a problem has been solved helps others searching so, if your problem is now solved, please view your first post in this thread and click the Edit button (top right in the post) and add [Solved] in front of the subject.
AOO 4.1.5, Windows 7 Home 64 bit

See the Writer Manual, the Writer FAQ, the Writer Tutorials and the Writer guide.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 5689
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: How do you give plain text files a default opening forma

Postby Villeroy » Fri Jun 15, 2018 11:47 am

Bind a custom keyboard shortcut or some toolbar button to character style "Source Text". Mine is Ctrl+9. Ctrl+0 is for text body, Ctrl+1 to 5 are for different levels of column headers.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 16.04, OpenOffice 4.x & LibreOffice 5.x
User avatar
Villeroy
Volunteer
 
Posts: 25701
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Writer

Who is online

Users browsing this forum: No registered users and 34 guests