Free Support Forum - aspose.com

Using EMF and WMF Files with Aspose.Slides


Hi. We are in the process of evaluating Aspose.slides for .Net and want to know if we will be able to insert/embed wmf or emf meta files into our slides? We are using C# for development.

Please let us know. If possible give some code examples as well.

Thanks,
Aseem

Dear Aseem,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.Slides.

Yes, you will be able to insert/embed wmf or emf meta files into your slides.

Ok. Well here’s the error message that I get when trying to Insert/Embed a .emf file (attached herewith - I had to rename it as jpg in order to be able to upload it).
The error message is:
A first chance exception of type ‘System.ArgumentException’ occurred in System.Drawing.dll

Please help

I did not get any problem adding the emf file attached by you. Please see the code below and output ppt.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

C#

Presentation pres = new Presentation();

Slide sld = pres.GetSlideByPosition(1);

Aspose.Slides.Picture pic = new Aspose.Slides.Picture(pres, @"d:\downloads\Picture.jpg");

int picId=pres.Pictures.Add(pic);

sld.Shapes.AddPictureFrame(picId, 0, 0, 4000, 3000);

pres.Write("c:\\outEmf.ppt");