About COM-based application logic
-
I need a mechanisme to handle with EXCEL, like creating and reading Excel files. For this, at starting a new C# windows application, I have added COM reference, by using the "AddReference" dialog box's COM tabsheet. In fact there are two smilar object definiton there: -Microsoft Excel 5.0 Object Library -Microsoft Excel 11.0 Object Library. I have chosen the "11.0"; At the and I managed to handle Excel Files as I wish. But, when I run my application at another pc (that is the one of our customer), it causes exceptions. I noticed that my computer Excel versiyon is 11.xxx which corresponds to Excel-2003, whereas our customer has the Excel-2002. The reason seems the version's difference. Right? Using COM isn't a good idea? Or Which manner I should use for works with Excel Files? Maybe I use the wrong Classes or Interfaces in the COM object. What to do to avoid version differences; at least close to each other versions? Or Should I prepare seperate applications for each version of Excel.? Thanks to all of you; for help to my this problem and previous ones. I love CodeProject and you all. :)
-
I need a mechanisme to handle with EXCEL, like creating and reading Excel files. For this, at starting a new C# windows application, I have added COM reference, by using the "AddReference" dialog box's COM tabsheet. In fact there are two smilar object definiton there: -Microsoft Excel 5.0 Object Library -Microsoft Excel 11.0 Object Library. I have chosen the "11.0"; At the and I managed to handle Excel Files as I wish. But, when I run my application at another pc (that is the one of our customer), it causes exceptions. I noticed that my computer Excel versiyon is 11.xxx which corresponds to Excel-2003, whereas our customer has the Excel-2002. The reason seems the version's difference. Right? Using COM isn't a good idea? Or Which manner I should use for works with Excel Files? Maybe I use the wrong Classes or Interfaces in the COM object. What to do to avoid version differences; at least close to each other versions? Or Should I prepare seperate applications for each version of Excel.? Thanks to all of you; for help to my this problem and previous ones. I love CodeProject and you all. :)
You may use 11.0 on your development machine and the same can be used on other machines as well (even though these machines have a different version). To achieve this, you need to late bind the excel object using "CreateObject" method.
Best Regards, Sam Xavier www.componentone.com