1

I am writing an application that works with Excel files. So far I have been using Gembox spreadsheet to work with excel files. However, I discovered using Gembox spreadsheet I can save pics to excel files, but not retrieve them. Anyone can recommend how to retrieve a pic from excel file? Thank you

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
M. Levin
  • 163
  • 1
  • 11

1 Answers1

0

Here is how you can retrieve an image from an Excel file with GemBox.Spreadsheet:

ExcelFile workbook = ExcelFile.Load("Sample.xlsx");
ExcelWorksheet worksheet = workbook.Worksheets.ActiveWorksheet;

// Select Picture element.
ExcelPicture picture = worksheet.Pictures[0];

// Import to PictureBox control.
this.pictureBox1.Image = Image.FromStream(picture.PictureStream);

// Or write to file.
File.WriteAllBytes("Sample.png", picture.PictureStream.ToArray());
Mario Z
  • 4,328
  • 2
  • 24
  • 38