How can I convert text in an Emacs buffer, to a .odt file, from there usable by LibreOffice?

Assume I've got an ordinary text file in an Emacs buffer. I want to convert it to a .odt file, possibly adding italics and/or boldface characters. From lisp I can do anything Emacs can do; also, I can pass bash commands to a bash window, as needed. Once I've created the .odt version I assume LibreOffice can be used without too much aggravation. How do you suggest I proceed?


Solution 1:

I do this often. Copy the text into Emacs's kill buffer (ESC < ESC > ESC w), open a LibreOffice text document, Paste.

Much easier than trying to generate .odt format inside Emacs.

Solution 2:

To convert plain text in a text buffer to an .odt file, you will need to study the file format of the .odt file format. Essentially, an .odt is a zip-compressed file, containing text and graphics of the document organized in a specified folder structure. Thus, that will require some research from your part and some Lisp programming if nobody did this before and published the code.

Ask yourself whether there are likely better ways. If you save to a plain text file, you will be able to open it in LibreOffice without effort. Text could also be copied to the clipboard and pasted.