Followers

My Visual Studio Achievements

Twitter

Tuesday, January 13, 2009

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.

These assemblies are different for different office versions.OfficeXP uses 10.0.0.0, Office2003 uses the interop version of 11.0.0.0 and Office 2007 uses the version of 12.0.0.0 etc...

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.

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

I experience 2 issues with this code.1 - On Excel 2003, if I insert images (bmp or jpeg) around 40kb, the resulting saved images (jpeg) are around 4k ... Is there any trick to keep the initial resolution ?2 - If the Excel file contains "a lot" of images (more than 100) most of the saved images are around 1k (and debugger show that image after Clipboard.GetImage() have heigth=1).

Now, forgiving C#, if I save the document as (HTML or Web page), I get all the images (duplicated, 1 low resolution image, the other one identical to the image inserted in the document). So, clearly it is possible to extract inserted picture without any resolution loss but...how ?

I experience 2 issues with this code.1 - On Excel 2003, if I insert images (bmp or jpeg) around 40kb, the resulting saved images (jpeg) are around 4k ... Is there any trick to keep the initial resolution ?2 - If the Excel file contains "a lot" of images (more than 100) most of the saved images are around 1k (and debugger show that image after Clipboard.GetImage() have heigth=1).

Now, forgiving C#, if I save the document as (HTML or Web page), I get all the images (duplicated, 1 low resolution image, the other one identical to the image inserted in the document). So, clearly it is possible to extract inserted picture without any resolution loss but...how ?

hii !! nice post ! I had a question.I have a worksheet containing a table of data. One of the columns contains images( each row may or may not contain an image ). Is there any way I can figure out which row I am picking the image from ?

I know a lot of good programs and one of them pleased me. It to my surprise decided all my old problems with damaged excel files. Perhaps it will help in similar conditions, for example in this - recover Excel.

I must show some thanks to this writer just for bailing me out of this particular issue. As a result of browsing through the net and seeing views which are not productive, I assumed my life was well over. Being alive devoid of the solutions to the issues you have fixed as a result of your entire post is a serious case, and ones that could have negatively damaged my entire career if I had not come across your web site. That expertise and kindness in dealing with a lot of stuff was crucial. I am not sure what I would’ve done if I had not encountered such a subject like this. I’m able to at this time look forward to my future. Thanks so much for your skilled and sensible guide. I will not hesitate to suggest your blog to anybody who needs and wants support about this topic. Cell Phone Lookup

i am having a erroe in this code errer line is: ApplicationClass app = new ApplicationClass();and error is:Error 1 Interop type 'Microsoft.Office.Interop.Excel.ApplicationClass' cannot be embedded. Use the applicable interface instead.