Tool for viewing LibreOffice Writer files in terminal window
Solution 1:
libreoffice
provides a --convert-to
option which can be used to convert a document to e.g. text or html:
convert
input.odt
toinput.txt
:libreoffice --convert-to "txt:Text (encoded):UTF8" input.odt
convert every
.odt
in the current directory to.html
:libreoffice --convert-to "html:XHTML Writer File:UTF8" *.odt
convert every
.ods
in the current directory to.csv
:libreoffice --convert-to csv *.ods
The output can be opened with the pager or terminal browser of your liking: less
, most
or w3m
to list just three.
Solution 2:
There is a tool called odt2txt
that can convert odt
to txt
.
Compared to libreoffice I can see two benefits:
- Lightweight if you don't have libreoffice installed (e.g. on a server)
- It can print to stdout for direct viewing of files.
Installation:
sudo apt install odt2txt
Then you can directly view an odt
:
odt2txt document.odt | less