Search code examples
emacsziporg-modeopendocument

How to export in ODT in org-mode?


When using org-mode, I would like to be able to save my org file (called here pad.org) in a ODT format. Here is what I have when trying save the file pad.org,

Auto-saving...done
org-babel-exp process python at position 2716...
Evaluate this python code block on your system? (y or n) n
Evaluation of this python code block is aborted.
LaTeX to MathML converter not available.
Formatting LaTeX using verbatim
Embedding c:/Users/Julien/Documents/ORG/img/IMG_3130.jpg as Images/0001.jpg...
Embedding c:/Users/Julien/Documents/ORG/img/ergoemacs-layout-fr.png as Images/0002.png...
Wrote c:/Users/Julien/AppData/Local/Temp/odt-ANDdwG/meta.xml
Using schema c:/Emacs/emacs-26.3-x86_64/share/emacs/26.3/etc/schema/od-schema-v1.2-os.rnc [2 times]
Saving file c:/Users/Julien/AppData/Local/Temp/odt-ANDdwG/styles.xml...
Wrote c:/Users/Julien/AppData/Local/Temp/odt-ANDdwG/styles.xml
Using vacuous schema
Wrote c:/Users/Julien/AppData/Local/Temp/odt-ANDdwG/mimetype
Using vacuous schema
Saving file c:/Users/Julien/AppData/Local/Temp/odt-ANDdwG/META-INF/manifest.xml...
Wrote c:/Users/Julien/AppData/Local/Temp/odt-ANDdwG/META-INF/manifest.xml
Saving file c:/Users/Julien/AppData/Local/Temp/odt-ANDdwG/content.xml...
Wrote c:/Users/Julien/AppData/Local/Temp/odt-ANDdwG/content.xml
Creating ODT file...
Running zip -mX0 pad.odt mimetype

When zip.exe is running, the GUI opens and I get the error message

Can't open -mX0 pad.odt

I'm a new user of emacs and org-mode on Windows 10. In the .emacs file I have the following lines :

;; Load ODT backend to allow for exporting to open document format.
(eval-after-load "org" '(require 'ox-odt nil t))

;;set env for odt
(setenv "PATH" (concat (getenv "PATH") ";" "C:\zip"))
    (setq exec-path (append exec-path '("C:\zip")))

In the folder C:\zip, I placed the zip executable (in fact Wiz.exe renamed zip.exe). With the command C-x C-e o o, I get the error message mentioned above.

I also tried with 7z.exe. But in that case, I have the error message :

Embedding c:/Users/Julien/Documents/ORG/img/ergoemacs-layout-fr.png as Images/0002.png...
Wrote c:/Users/Julien/AppData/Local/Temp/odt-gAEsLl/meta.xml
Using schema c:/Emacs/emacs-26.3-x86_64/share/emacs/26.3/etc/schema/od-schema-v1.2-os.rnc [2 times]
Saving file c:/Users/Julien/AppData/Local/Temp/odt-gAEsLl/styles.xml...
Wrote c:/Users/Julien/AppData/Local/Temp/odt-gAEsLl/styles.xml
Using vacuous schema
Wrote c:/Users/Julien/AppData/Local/Temp/odt-gAEsLl/mimetype
Using vacuous schema
Saving file c:/Users/Julien/AppData/Local/Temp/odt-gAEsLl/META-INF/manifest.xml...
Wrote c:/Users/Julien/AppData/Local/Temp/odt-gAEsLl/META-INF/manifest.xml
Saving file c:/Users/Julien/AppData/Local/Temp/odt-gAEsLl/content.xml...
Wrote c:/Users/Julien/AppData/Local/Temp/odt-gAEsLl/content.xml
Creating ODT file...
Running zip -mX0 pad.odt mimetype
OpenDocument export failed: Unable to create OpenDocument file.  Zip failed with error (
7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21

Solution

  • Based on https://lists.gnu.org/archive/html/emacs-orgmode/2013-04/msg00538.html, you may also get the zip executable from

    https://fossies.org/windows/misc/zip300xn.zip/