My Technical Notes

Wednesday, 18 March 2015

Inserting an OpenOffice Draw diagram into an MS Word document

I am using MS Office 2010 and OpenOffice 4.1.1.

Let's say you are storing all your files in a folder named `dissertation`. This folder has the following structure:

  • `dissertation` - the containing folder for all dissertation-related documents.
    • `dissertation.docx` - the Word 2010 document.
    • `tools_diagram.odg` - the Draw document
    • `exports` - a folder containing all exported diagrams.
      • `tools_diagram.emf` - The above diagram's export in EMF format (Enhanced Meta File).

Within `tools_diagram.odg`, set all the margins to zero.

The first step is to export `tools_diagram.odg` to an `.emf` file:

  • Click on `File` → `Export`, set the path to be in `exports` folder, `Save as type` = `EMF` and accept the default options and click `OK`.

Next, within your Word document, you use `Ctrl+F9` to insert a field code bracket, and within it type:


INCLUDEPICTURE "exports/tools_diagram.emf" \d \* MERGEFORMAT

NOTE: you must select the field, typically by using Select All/`Ctrl+a`, and then press `F9` to make Word "pick up" the field. Thereafter use `Alt+F9` to toggle the field and then you should see your diagram.

NOTE: with an absolute path, e.g. "C:\Temp\My Image.png", you need to replace the backslashes with two backslashes, or one forward slash; spaces have to be escaped by preceding them with a backslash.

Thereafter, press `F9`. Use `Alt+F9` to toggle the field codes so you can see your diagram. You may have to resize the diagram.

No comments: