Adding picture as EMF file

Is it possible to insert images in EMF format into Excel cells?

Yes. You can download and try Aspose.Excel.

Hi Laurence,
thank you for the answer.
Downloaded last version of Aspose.Excel, tried to insert .EMF file by means of it.
Unfortunately, it doesn’t work.

Here’s what works:
_excelTo.Worksheets[_sheetNumbTo].Pictures.Add( _cellTTo, _cellLTo, _cellBTo+1, _cellRTo+1, @“c:\temp.bmp” );
After this operation a viewable picture is inserted into an Excel sheet.

Here’s what won’t work:
_excelTo.Worksheets[_sheetNumbTo].Pictures.Add( _cellTTo, _cellLTo, _cellBTo+1, _cellRTo+1, @“c:\temp.emf” );

When trying to open the excel file after EMF has been inserted, a popup says;

File error: data may have been lost.
And no picture is visible in the sheet.
When insert .EMF manually, all works OK.
What do we do wrong?

Could you please post your emf file here? I will check it ASAP.

Here you are!

Try this fix, please.

Now it works!!

Laurence, many thanx.

Hi Laurence,
I have exactly the same problem. I tried downloading the latest release of Aspose.Excel (3.4.4.0) but it didn’t help. Could you please send me the same fix you sent to Cadavr.
Thanks!

I managed to download the fix after logging in. I can now add my .emf-image but after adding the image it is no longer in its original vector-format. This is not so important to me but I thought I should mention it.

Yes. The image format is converted from emf to png. MS Excel also converts emf files.

Hi Lawrence. Seems like there’s some difference between excel’s own action and what Aspose does.

It’s caused by this image is distorted in different ways. Please right click the image and choose “Format Pictures”->“Size”->uncheck “Lock aspect ratio”->Set height and width to 100%. You will see the image is same as those manually inserted in MS Excel.