I am trying to add the Microsoft Excel 11.0 Object Library com to my project but It doesnt exist, only 12 does. And so I cannot use Microsoft.Office.Interop. How can I add Microsoft.Office.Interop or Microsoft Excel Object Library to my project without purchasing and installing the old 11 version of excel?
-
2Version 12 should be backwards compatible.Robert Harvey– Robert Harvey2011-10-21 04:17:59 +00:00Commented Oct 21, 2011 at 4:17
-
As a note, I only have the excel reader installed. All that is available to me is Microsoft.Office.Core.Drake– Drake2011-10-21 04:20:18 +00:00Commented Oct 21, 2011 at 4:20
-
You cannot test and support your product without the correct version of Office installed on your dev machine. Since you don't have any, getting the right version shouldn't be an issue.Hans Passant– Hans Passant2011-10-21 07:54:20 +00:00Commented Oct 21, 2011 at 7:54
3 Answers
What you probably want is Assembly Binding Redirection.
When a Visual Studio Tools for Office solution that references a Microsoft Office 2003 primary interop assembly runs on a computer that has the 2007 Microsoft Office version of the same primary interop assembly, the binding redirect assembly instructs the .NET Framework runtime to load the 2007 Microsoft Office version of the primary interop assembly.
http://msdn.microsoft.com/en-us/library/2fc472t2(v=vs.80).aspx
However, if you want to develop specifically using the old 2003 version of the assembly, it's highly likely that you will need Excel 2003 installed on your computer to do it.
It goes without saying that the license agreements probably require you to have a full copy of Excel to develop programs with the primary interop assembly.
Comments
The Primary Interop Assembly is using Excel in the background - thus you need Excel installed locally.
EPPlus is a free alternative if you just need reading and writing of Excel files - it is also a magnitudes faster than using the C# Microsoft Excel 11.0 Object Library.
Check if this fits to your requirements.