[Solved] Opening text files automatically

Discuss the word processor
Post Reply
nichollsvi
Posts: 15
Joined: Fri Feb 08, 2019 4:26 am

[Solved] Opening text files automatically

Post by nichollsvi »

Hi,

When opening a text file, I always get asked ascii filter options before I can open it. Is there any way to automatically open it without that ascii filter options panel?

Thanks,

Vic
Last edited by robleyd on Thu Aug 26, 2021 5:16 am, edited 1 time in total.
Reason: Tag [Solved]
OpenOffice 4.1.5 on Windows 10
User avatar
Zizi64
Volunteer
Posts: 11345
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Opening text files automatically

Post by Zizi64 »

When opening a text file, I always get asked ascii filter options before I can open it. Is there any way to automatically open it without that ascii filter options panel?
Are these files Office documents or they are really pure .txt files?
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
nichollsvi
Posts: 15
Joined: Fri Feb 08, 2019 4:26 am

Re: Opening text files automatically

Post by nichollsvi »

They are pure text files. I saved them as text files from Open Office.
OpenOffice 4.1.5 on Windows 10
User avatar
Zizi64
Volunteer
Posts: 11345
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Opening text files automatically

Post by Zizi64 »

I saved them as text files from Open Office.
Why?

Whí not save the original document into the native, international standard .odf file format? (and then you can export a copy into any other format. When you want re-edit the original document, it will remember to all of the formatting properties. You can not store any formatting property, or character coding property in a pure text file. Therefore you must give the coding property for the office suite in the import filter.)

If you familiar to the macros, then you can write a subroutine for opening .txt files with predefined coding an other properties. But it is better and easier to use the native file formats.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
nichollsvi
Posts: 15
Joined: Fri Feb 08, 2019 4:26 am

Re: Opening text files automatically

Post by nichollsvi »

Because if I transfer the file to other folks, not everyone has odt or wants to download OO.
OpenOffice 4.1.5 on Windows 10
User avatar
RoryOF
Moderator
Posts: 34570
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Opening text files automatically

Post by RoryOF »

If they don't need to edit the file, send it as a PDF. Most modern versions (since 2007) of MS Office can read .odt format, but most MS Office users don't know that.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
Zizi64
Volunteer
Posts: 11345
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Opening text files automatically

Post by Zizi64 »

Because if I transfer the file to other folks, not everyone has odt or wants to download OO.
It is not a reason to store the document in pure text format - if you must reedit it.

Otherwise:

Google docs can open the .odt.
LibreOffice can open the .odt.
Apache OpenOffice can open the .odt.
NeoOffice can open the .odt.
CollaboraOnline can open the .odt.

MS Office can open the .odt.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
MrProgrammer
Moderator
Posts: 4883
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Opening text files automatically

Post by MrProgrammer »

nichollsvi wrote:Is there any way to automatically open [a text file] without that ascii filter options panel?
If  my  file name ends in .txt, when I use File → Open in OpenOffice the file loads into Writer immediately with no ASCII filter dialog.
If your file does not end in .txt, how do you expect OpenOffice to know that it is a text file for Writer?

If you need any additional assistance attach a document demonstrating the difficulty (remove confidential information then use Post Reply, not Quick Reply, and don't attach a picture instead of the document itself).
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
nichollsvi
Posts: 15
Joined: Fri Feb 08, 2019 4:26 am

Re: Opening text files automatically

Post by nichollsvi »

Thanks. MrProgrammer that was what I had to do (file - open in OO). Thanks again everyone for your help.
OpenOffice 4.1.5 on Windows 10
Bill
Volunteer
Posts: 8929
Joined: Sat Nov 24, 2007 6:48 am

Re: Opening text files automatically

Post by Bill »

MrProgrammer wrote:If  my  file name ends in .txt, when I use File → Open in OpenOffice the file loads into Writer immediately with no ASCII filter dialog.
This only works on my Linux system if the file uses Unix/Linux line endings (paragraph breaks). If the file uses Mac or Windows line endings, the Text Import dialog opens and the file opens in Calc!

I have many old text files from Windows. To open those text files in Writer, I have to double-click the file and make sure that the correct line ending (paragraph break) is selected on the ASCII Filter Options dialog.
AOO 4.1.14 on Ubuntu MATE 22.04
User avatar
MrProgrammer
Moderator
Posts: 4883
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: [Solved] Opening text files automatically

Post by MrProgrammer »

Bill wrote:I have many old text files from Windows. To open those text files in Writer, I have to double-click the file and make sure that the correct line ending (paragraph break) is selected on the ASCII Filter Options dialog.
Perhaps the -lf -tabs options of the tab2space command (part of the HTML Tidy Project) will be helpful. Your Linux distribution may already have this installed.
NAME
       tab2space - Utility to expand tabs and ensure consistent line endings

SYNOPSIS
       tab2space [options] [infile [outfile]] ...

DESCRIPTION
       tab2space expands tab characters into a specific number of spaces.
       It also normalizes line endings into a single format.

OPTIONS
       -help or -h    display this help message
       -dos or -crlf  set line ends to CRLF (PC-DOS/Windows - default)
       -mac or -cr    set line ends to CR (classic Mac OS)
       -unix or -lf   set line ends to LF (Unix / Mac OS X)
       -tabs          preserve tabs, e.g. for Makefile
       -t<n>          set tabs to <n> (default is 4) spaces
Or perl will do that:
# Convert DOS/Windows terminators to UNIX terminators
perl -pe 's|\r\n|\n|'

# Convert classic Mac terminators to UNIX terminators
perl -pe 's|\r|\n|'
I use MacOS and text files open immediately in Writer. It's only "classic" Mac from the previous century that used \r as a line terminator. MacOS (anything released in the last 20 years) is based on UNIX and uses \n as a delimiter:
$ hexdump -C <<EOF
> Foo
> Bar
> EOF
00000000  46 6f 6f 0a 42 61 72 0a                           |Foo.Bar.|
00000008
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
Bill
Volunteer
Posts: 8929
Joined: Sat Nov 24, 2007 6:48 am

Re: [Solved] Opening text files automatically

Post by Bill »

I couldn't find tab2space in my distribution's repository. I did find dos2unix which converted the line endings in my text files.
AOO 4.1.14 on Ubuntu MATE 22.04
nichollsvi
Posts: 15
Joined: Fri Feb 08, 2019 4:26 am

Re: [Solved] Opening text files automatically

Post by nichollsvi »

I used dos2unix on Linux systems. This is on a mac.
OpenOffice 4.1.5 on Windows 10
Post Reply