Save EMF file

Topics: Developer Forum, User Forum
Feb 15, 2010 at 9:47 AM

Hi, reading this discussion (http://phpexcel.codeplex.com/Thread/View.aspx?ThreadId=35045)  i was able to extract jpg and png images from a excel (.xls) file.

Now i have a file with only EMF format images, and as i understand echer reader is unable to extract them. Is there a way to have them extracted, maybe forcing excel to store them as JPG or png ? Many thanks, dario

Feb 15, 2010 at 1:48 PM

I was able to do this by cutting and pasting all images in my excel using this VBA code

Sub a()

For Each shp In ActiveSheet.Shapes

c = ActiveSheet.Shapes(shp.Name).TopLeftCell.Address

ActiveSheet.Shapes(shp.Name).Cut

ActiveSheet.Range(c).PasteSpecial

Next

End Sub

 

Developer
Feb 16, 2010 at 11:40 PM

Perhaps you can also open the xls file in Microsoft Office Excel 2007 and do a plain save as xlsx. If I recall correctly, EMF will be converted to PNG in that process.

Feb 17, 2010 at 4:07 PM

Thanks, I tried cos it seems quicker ... i saved it in xlsx then reopened and saved as xls, but images are still saved as EMF

Developer
Feb 19, 2010 at 12:15 AM
darida wrote:

Thanks, I tried cos it seems quicker ... i saved it in xlsx then reopened and saved as xls, but images are still saved as EMF

I tested this for myself now and you are right.

Some rearrangements are necessary in PHPExcel how images are treated. In the future it may be possible to extract EMF images.