Office Primary Interop Assemblies
These assemblies/dlls contain classes which help us to work or interact with the Office files through our .Net programs.They maintain clean object model which represents the structure of office files like .xls,.doc etc...To work with these different office file formats we have to use separate office interop assemblies.
More details here.
Microsoft Excel interop assembly.
This assembly gives access to excel files.We can interact with the excel workbooks,worksheets,cells etc.We can do a bunch of operations such as creating a work book , referring the cells inside a sheet and lot more using this.The main interop dll of excel is Microsoft.Office.Interop.Excel.dll .It contains the excel object model.The main classes which we need to interact are ApplicationClass,Workbook & Worksheet
If you want to use the excel interop you have to refer the concerned assembly in your application.Then create instance of ApplicationClass.Using the ApplicationClass object you can create excel Workbook which is equivalent to the actual .xls or .xlsx file.Workbook contains a collection of Worksheets which again contains cells,rows and columns.We can set or get the values from these cells as per the requirement.
Some links to create and read Excel files using office interop.
The normal reading of cells will go smoothly with these things.But when we come to reading of images we can not do that very easily because the images are not bound to the cells.More specifically ,they are bound to the sheet.Here is one method to read images from worksheet
Basic idea of Reading Image
Let us first check the object model.These is no property collection in the Worksheet interface to get images directly.We have to use the method
Thus this method need the name of the image.We have to iterate through the WorkSheet.Shapes collection, if you don't know the image name in advance.
Once we execute the Pictures method we gets the image as object Picture interface.This again don't have any direct method which returns the image as useful.
We have to copy the image into clipboard using the method
Yes we now have the image in clipboard.Get the image from there and show or save as per the requirement.
pictureBox.Image = img;
Here is a small sample which reads first image from a .xls file and shows in a picture box.I have used Office 2003 interop assemblies (22.214.171.124)