Cannot "Ungroup" an EMF file inserted into PowerPoint

B

Bob

I'm having a problem with some of the EMF (Windows Enhanced Metafile) images
created by our charting application. When a "problem" EMF image is inserted
into a PowerPoint slide it can not be successfully "ungrouped" so that the
individual elements of the image can be edited. Some EMF images we create
can be ungrouped, and others cannot be ungrouped. We are scratching our head
to determine what property of the "bad" images prevents them from
ungrouping. Actually, I think the problem is that these "bad" images simply
cannot be successfully converted to a Microsoft Office drawing object.

In http://www.pqsystems.com/temp/EmfBug.zip are two EMF images from our
charting application, and a PowerPoint file for each image, where the image
has not yet been "ungrouped", i.e. it is freshly inserted. The Good.emf can
be ungrouped, and the Bad.emf exhibits the problem.

Here are the steps you can take to duplicate this issue:

1) In PowerPoint, use "Insert > Picture > From File" to insert either
Good.EMF (the image that ungroups OK) or Bad.EMF (the image with the ungroup
problem) into a slide.

2) Right-click on the image and select "Grouping > Ungroup". Answer YES when
asked if you want to convert the image to a Microsoft Office drawing object.

3) Step 2 succeeds when using Good.EMF and you can manipulate the ungrouped
elements of the image. However, step 2 apparently fails when using Bad.EMF -
the image apparently is never successfully converted/ungrouped - you can try
to ungroup again, and again, and again, and it never succeeds.

By the way, the "ungroup" problem is not unique to PowerPoint, the same
behavior occurs when the image is inserted into a Word document.

We suspected that perhaps Bad.emf does not contain vector commands, i.e. it
contains a bitmap, and that's why it cannot be converted. But we used the
EMF record dumper at http://www.fengyuan.com/bin/emf.zip to look at the GDI
records contained in both Good.emf and Bad.emf and both appear to contain
normal looking vector graphic commands.

Can anyone tell me why Bad.emf cannot be successfully converted to a
Microsoft Office drawing object?

Another thought I had was whether it is possible to run the program that
Office uses to do the conversion from EMF to a Microsoft Office drawing
object? What program is used? I thought perhaps if I used that program,
outside of Office, I might get a meaningful error message that indicates why
Bad.EMF cannot be converted.

Any suggestions on how to resolve this problem are welcomed.
 
S

Steve Rindsberg

I'm having a problem with some of the EMF (Windows Enhanced Metafile) images
created by our charting application. When a "problem" EMF image is inserted
into a PowerPoint slide it can not be successfully "ungrouped" so that the
individual elements of the image can be edited. Some EMF images we create
can be ungrouped, and others cannot be ungrouped. We are scratching our head
to determine what property of the "bad" images prevents them from
ungrouping. Actually, I think the problem is that these "bad" images simply
cannot be successfully converted to a Microsoft Office drawing object.

In http://www.pqsystems.com/temp/EmfBug.zip are two EMF images from our
charting application, and a PowerPoint file for each image, where the image
has not yet been "ungrouped", i.e. it is freshly inserted. The Good.emf can
be ungrouped, and the Bad.emf exhibits the problem.

Here are the steps you can take to duplicate this issue:

1) In PowerPoint, use "Insert > Picture > From File" to insert either
Good.EMF (the image that ungroups OK) or Bad.EMF (the image with the ungroup
problem) into a slide.

2) Right-click on the image and select "Grouping > Ungroup". Answer YES when
asked if you want to convert the image to a Microsoft Office drawing object.

3) Step 2 succeeds when using Good.EMF and you can manipulate the ungrouped
elements of the image. However, step 2 apparently fails when using Bad.EMF -
the image apparently is never successfully converted/ungrouped - you can try
to ungroup again, and again, and again, and it never succeeds.

By the way, the "ungroup" problem is not unique to PowerPoint, the same
behavior occurs when the image is inserted into a Word document.

We suspected that perhaps Bad.emf does not contain vector commands, i.e. it
contains a bitmap, and that's why it cannot be converted. But we used the
EMF record dumper at http://www.fengyuan.com/bin/emf.zip to look at the GDI
records contained in both Good.emf and Bad.emf and both appear to contain
normal looking vector graphic commands.

Can anyone tell me why Bad.emf cannot be successfully converted to a
Microsoft Office drawing object?

Another thought I had was whether it is possible to run the program that
Office uses to do the conversion from EMF to a Microsoft Office drawing
object? What program is used? I thought perhaps if I used that program,
outside of Office, I might get a meaningful error message that indicates why
Bad.EMF cannot be converted.

It certainly is good at keeping an idiot entertained for hours. Ungroup. Yes.
Ungroup. Yes. Ungroup. Yes .....

My guess is that it's a bug in the EMF filter/conversion routines (no surprise
that the same problem occurs in Word as well ... all of the Office apps share
the same graphics filters).

To confirm your "Is it a bitmap?" tests, it isn't. I brought both EMFs into
Corel Draw, which had no trouble ungrouping both.

But here's a minor aha ... select Bad, choose Edit, Copy. Then Edit, Paste
Special, as WMF. Now you can ungroup it.
 
T

TAJ Simmons

Bob,

Very strange.

powerpoint treats the bad.emf as a picture, even though it clearly contains
vector information


I put both emfs into corel draw

exported both as emfs

inserted into powerpoint

and both insert and ungroup just fine.

So I cant' say for sure what the problem is.

My guess is there is something in bad.emf that powerpoint cannot translate
properly... like a strange like style or similar

Cheers
TAJ Simmons
microsoft powerpoint mvp

awesome graphics for powerpoint
http://www.PresentationPictures.com
free powerpoint pictures, tutorials, hints, tips and more...
 
B

Bob

We finally tracked down what causes this problem.

When the following GDI code is used to create a pen and then draw a dotted
line using that pen, the problem occurs:

hPen = ExtCreatePen(PS_COSMETIC | PS_USERSTYLE, // Windows enum for
PenStyle.
LineWidth, &lb, PatternLen, Pattern);

The problem doesn't occur when we use this code:

hPen = CreatePen(LineStyle, LineWidth, LineColor);
 
T

TAJ Simmons

My guess is there is something in bad.emf that powerpoint cannot translate
properly... like a strange like style or similar

Not a bad guess then :)

TAJ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top