I recently bought OmniGraffle Professional to make some diagrams for a Word document. OmniGraffle is a great program that lets me easily create nice looking graphics.
I was happily cutting and pasting diagrams into my Word X document. Then I decided to test the document on Windows XP with Word 2003, just to see how it looked. I was expecting a font that wasn’t optimum or maybe something else small. Much to my suprise, all the pictures were gone. There was a message “QuicktimeTM and a TIFF (LZW) decompressor are needed to see this picture.”
Huh? I have Quicktime installed… That pesky Unisys patent expired… WTF? Grrr. OK I’ll blame Microsoft.
Lots of Googling later, I found some solutions.
Copy As Vector PICT seemed like a great idea. In OmniGraffle: Edit -> Copy As -> Vector PICT. Then paste into Word. Unfortunately this make the text in my diagrams look like really bad. It worked well for simple test diagrams I created, but not for the real ones. This wasn’t going to work, I bought OmniGraffle to make pretty diagrams.
The suggestion that worked best was exporting as PNG in OmniGraffle and then in Word: Insert -> Picture -> From File.
Unfortunately this was a tedious process. Select a Canvas, Select All, Export to PNG. Repeat. OmniGraffle will export a complete Document to PNG, but it padded a bunch of whitespace around the document.
This is what AppleScript is for right? (I don’t know AppleScript so I’m going to learn it better before I complain that I don’t like it.) After my own attempts at writing this script failed the OmniGraffle forums provided a solution. There were more complex solutions, but I wanted something simple that would add a new export function.
I modified the script to name the PNG using the Canvas name. I added this to the OmniGraffle Scripts Folder. In OmniGraffle: Script Menu -> Open Scripts Folder -> Open OmniGraffle Pro Scripts Folder. Now I have a new “Export as multiple PNGs” menu option. The script menu must be enabled for this to work.
(* based on script from http://forums.omnigroup.com/showthread.php?t=146#post697 *) tell application "Finder" set saveFolder to desktop as string end tell tell application "OmniGraffle Professional" set theDocument to front document set canvasCount to count of canvases of theDocument repeat with canvasNumber from 1 to canvasCount -- yuck applescript is clunky. Is there a better way to get the canvas name? set canvasName to name of canvas canvasNumber of theDocument set canvas of front window to canvas canvasNumber of theDocument save theDocument as "png" in (saveFolder & canvasName & ".png") end repeat end tell
The new “Export as multiple PNGs” just saves a bunch of PNG images to the desktop. This makes inserting the image into Word document easy because the Finder has a Desktop shortcut on the Sidebar. I have a bunch of ideas about how this could be improved, but it works good enough so I’m sure it will just stay as-is.