F
F
Fedor unknown2020-04-14 14:49:19
linux
Fedor unknown, 2020-04-14 14:49:19

How to create a library office document via terminal?

Hello!
I can't create an office document through the terminal, I write, > file.odt

but in the end a plain text file is created
. How to be?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Saboteur, 2020-04-14
@saboteur_kiev

> file.odt
It's just a redirect to a file.
And what exactly do you write there - you parsed the libre office format and write data in this format, or just write text to a file and get a text file (logically?)

A
Alexey Cheremisin, 2020-04-14
@leahch

For a file to be libreoffice, it must be in libre office format. The contents of this file must comply with the odf standard, at a minimum.
Well, if you need to get this format from the input stream, use the pandoc utility for example. It must be installed separately, it is in the packages of the main distributions.

V
Vladimir Kuts, 2020-04-14
@fox_12

For example, in a hurry (requires the installed python pyodf package):

echo "Hello world" | python -c 'import sys;from odf.opendocument import OpenDocumentText;from odf.text import H, P, Span;textdoc = OpenDocumentText();p = P(text=sys.stdin.read());textdoc.text.addElement(p);textdoc.save("out.odt")'

5e95bc360ab0f116251434.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question