emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tom Short <tshort@epri.com>
To: emacs-orgmode@gnu.org
Subject: Org-mode to MS-Word/OOo with vector graphics
Date: Thu, 2 Sep 2010 14:45:22 +0000 (UTC)	[thread overview]
Message-ID: <loom.20100902T155338-260@post.gmane.org> (raw)

I've tried several approaches to converting org-mode files to MS-Word
or OpenOffice.org that retains vector graphics, especially
encapsulated postscript files. Some options I've tried include docbook
export with docbook2odf (doesn't work with docbook v5) and latex
export with tex4ht (converts graphics to png). 

HTML export with orgmode's html exporter worked the best for me. The
key is to have orgmode's exporter inline EPS (or other vector
graphics) rather than inserting a link. Both MS-Word and
OpenOffice.org can import html in this fashion and pull in the vector
graphics.

Although this isn't org-babel specific, it's convenient to use with
org-babel since there are so many ways to generate graphic files. See
below for an example that uses R to create EPS and windows metafiles
(windows only).

I'm curious to hear if it works for anyone else.

- Tom

----------------------------
#+TITLE: Vector graphic tests
#+BABEL: :session *R* :results output :exports both

This is a test of HTML export with vector graphics that can be read
into MS-Word and OpenOffice.org. We need to tell orgmode's export to
inline EPS and WMF files. Those image files won't be displayed in a
browser, but they will be imported into MS-Word or OpenOffice.org
Writer.

We also need to strip off the XML header line as discussed here

[[http://thread.gmane.org/gmane.emacs.orgmode/26236/focus=26238]]

That's taken care of by the "(setq org-export-html-xml-declaration"
below.

Note that all of this is based on with Windows XP and R 2.11.1.

#+begin_src emacs-lisp
(setq org-export-html-inline-image-extensions
  '("png" "jpeg" "jpg" "gif" "ps" "eps" "wmf" "emf"))

(setq org-export-html-xml-declaration
  '(("html" . "")
    ("php" . "<?php echo \"<?xml version=\\\"1.0\\\" encoding=\\\"%s\\\" ?>\";
?>")))
#+end_src


* EPS

For EPS import into MS-Word 2003, it works fine with the extension
".eps" but not always with the extension ".ps", so we can't use
org-babel-R's built-in graphics support which defaults to the ".ps"
extension. OpenOffice.org 3.2 seems to work fine with either
extension.

#+begin_src R  :results value file
  setEPS() # set up the postscript driver for EPS output
  fname = "cos.eps"
  postscript(fname)
  plot(cos)
  dev.off()
  fname
#+end_src

#+results:
[[file:cos.eps]]


* WMF

The WMF works in MS-Office and in OpenOffice.org. WMF files don't look as
nice as EPS files for printed output, but they sometimes work okay
in powerpoints.

#+begin_src R  :results value file
  fname = "sin.wmf"
  win.metafile(fname, width = 5, height = 5)
  plot(sin)
  dev.off()
  fname
#+end_src

#+results:
[[file:sin.wmf]]

             reply	other threads:[~2010-09-02 14:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-02 14:45 Tom Short [this message]
2010-09-02 19:21 ` Org-mode to MS-Word/OOo with vector graphics David Maus
2010-09-02 19:55   ` Short, Tom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20100902T155338-260@post.gmane.org \
    --to=tshort@epri.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).