Load an existing jpeg file into an existing picture

Hello support.


I am trying to load the content of an existing jpeg in an existing excel picture.
However, I dont want to keep the link - I want to load it once and forget about future changes in the source jpeg.

I am using the SourceFullName property

Dim s As String = "E:\Book1.xlsx"
Dim x As New Aspose.Cells.Workbook(s)
Dim p As Aspose.Cells.Drawing.Picture = x.Worksheets(“Sheet1”).Pictures(0)
p.SourceFullName = "E:\guido.jpg"
x.Save(s)

However, when I now look at the resulting worksheet, the content of the picture is not loaded.
Any ideas ? What am I doing wrong ?

thank you,

guido


Hi Guido,


Thank you for contacting Aspose support.

Your provided code snippet seems to update the property (SourceFullName) of the Picture object only, whereas your requirement is to update the image it self, that can be set using the Picture.Data property. Please check the following piece of code and give it a try on your end.

VB.NET

sheet.Pictures(0).Data = System.IO.File.ReadAllBytes(“D:/output.jpg”)


Please note, I have tested the case while using the latest version of Aspose.Cells for .NET 8.3.1.4 with success. In case you fail to get the desired results, please provide us your sample spreadsheet along with the image to be inserted, we will thoroughly check the scenario to assist you further in this regard.

works great.thnaks !!

Hi Guido,


Thank you for the confirmation. It is good to know that you are up & running again. Please feel free to write back in case you need our further assistance with Aspose APIs.