Поделиться через


Interop with Office

Before I dive in, I've put together a simple doc showing how you can liven up the clip art in Office using Graphic Designer that you might find of interest.

The other "feature" that was included in the current CTP of Expression Graphic Designer (EGD) is better interop with Office apps.  EGD now has vastly better support for importing WMF/EMF files and clipboard data.  In addition, if you want to pull out the original source image for a graphic in Office you can do so through the "Office Image" selection in the Paste Special menu item.

These were both done by me a few months ago as I grew frustrated with trying to get content back and forth between Office.  There is a lot of strangeness that occurs that makes the experience less than stellar.  To help shed some light on the situation I'll run through exactly what happens in the rest of this post.

When you copy from EGD a BMP, PNG, GIF, and JPG are put on the clipboard at the current resolution of the document.  PNG is particularly useful with Office applications as it supports transparency.  The first strangeness is that if you paste into Office you get a different default paste depending on the application you are in.  In the case of Word you do not get PNG by default and as such you must paste special to get the PNG.  In PowerPoint, however, you do get the PNG by default.

Where things get particularly ugly is when you copy out of Office.  Office will always render graphics at your screen resolution (typically 96dpi).  For me, at least, this usually ends up looking horrible.  A great example is taking a screenshot out of a PowerPoint presentation.

To get the original image out of Office you hit the second strangeness...  In Word it isn't possible (afaik).  If you want to get the image out you must first copy from Word and then into PowerPoint where you can save the original.  (There are more differences with the other Office apps.  I'll only detail Word/PowerPoint here for now.)  In PowerPoint if you right click on a graphic and select "Save As Picture".  Depending on the source you may get a drop-down arrow on the "Save" button that will let you "Save Original Picture".

Since Office obviously keeps the original PNG I thought it would be much better to grab that if it were at all possible, which fortunately it is.  If you copy an image out of Office you will get the new paste special selection of "Office Image" as previously described.  The image will be inserted as an image object that will be sized the same as the object in Office with the full DPI of the backing image.  (Rotation is something we might support later.  Some other special features such as drop shadows might be added if there is enough interest.)

If you take things back into Office again you'll rasterize at the doc DPI as stated earlier.  It is best, of course, to keep XPR files around for any content you send to Office.

Office drawings (AutoShapes, WordArt, etc.) are put on the clipboard as EMF, so you're best off pasting special in EGD as this format.  (Same goes with WMF/EMF clipart.)

(This brings up an interesting little side effect that you can take advantage of in Office. If you copy an Office object that normally doesn't antialias such as a chart you can get antialiasing by making a few in-app conversions. Take a chart, copy, and then paste as EMF back into the Office app. After pasting as EMF right click and select "Edit Picture". You now have an antialiased copy of the original!)

I intend to make the experience a little more transparent in the future if at all possible.  I'll be looking for any and all feedback on what would make life easier for you.  In addition, if you have any WMF/EMF content that you can't get into EGD, please let me know and I'll take a look.  A metafile is simply a collection of Win32 drawing commands, which makes it pretty broad in theory.  In practice, however, not many calls are supported by apps that output metafiles.  Your input will help me prioritize.