Issue with Excel vesion in C#
-
Hi , I have a windows application developed in dot net 3.5 framework where i am importing and exporting data to excel.I am using Microsoft Office interop excel and have added the version 14.0 as reference to my application. When i run this application on a machine having Office 2007 ( version 12.0) my application does not work. My question is why is it having this issue and why am i getting an exception 14.0 could not loaded
-
Hi , I have a windows application developed in dot net 3.5 framework where i am importing and exporting data to excel.I am using Microsoft Office interop excel and have added the version 14.0 as reference to my application. When i run this application on a machine having Office 2007 ( version 12.0) my application does not work. My question is why is it having this issue and why am i getting an exception 14.0 could not loaded
The interop libraries are different between 12 - and 14, hint that is why they have versions! There is a reason we NEVER, EVER, under ANY circumstances use Office products in any of our solutions. MS has no compunction breaking systems going forward let alone backwards compatibility.
Never underestimate the power of human stupidity RAH
-
The interop libraries are different between 12 - and 14, hint that is why they have versions! There is a reason we NEVER, EVER, under ANY circumstances use Office products in any of our solutions. MS has no compunction breaking systems going forward let alone backwards compatibility.
Never underestimate the power of human stupidity RAH
I though you could include the Dll that will make an Excel file in your solution, so regardless of wheter or not you had Excel install, it would create the file, or?
-
I though you could include the Dll that will make an Excel file in your solution, so regardless of wheter or not you had Excel install, it would create the file, or?
To be honest I am not up with the latest Office capabilities - for obvious reasons, I'm assuming you are talking about the Interop files which can be included with the app but I'm dammed sure they are not compatible between versions which is the OPs issue I believe.
Never underestimate the power of human stupidity RAH
-
To be honest I am not up with the latest Office capabilities - for obvious reasons, I'm assuming you are talking about the Interop files which can be included with the app but I'm dammed sure they are not compatible between versions which is the OPs issue I believe.
Never underestimate the power of human stupidity RAH
When I went to collage I learned that you should always create a new Excel Object without using Interop, as different Excel versions wouldnt be compatible otherwise, i.a. programming without intellisence. I did some internal programming for a company, and I can tell you that it was a nightmare with just 10 useres... When I found out that one of them had Excel 2003 and the rest had Excel 2005 (or soemthing like that) I just included the dll, the Library 12, and It all worked as expected. However I would never recomend doing this on a massive scale...
-
Hi , I have a windows application developed in dot net 3.5 framework where i am importing and exporting data to excel.I am using Microsoft Office interop excel and have added the version 14.0 as reference to my application. When i run this application on a machine having Office 2007 ( version 12.0) my application does not work. My question is why is it having this issue and why am i getting an exception 14.0 could not loaded
Create a Primary Interop Assembly (PIA) with an old version of Excel (2007 or older), and use that for your coding. Newer version are normally backwards compatible. I use a PIA generated with Office XP, and do not encounter problems with Office 2010.
-
Hi , I have a windows application developed in dot net 3.5 framework where i am importing and exporting data to excel.I am using Microsoft Office interop excel and have added the version 14.0 as reference to my application. When i run this application on a machine having Office 2007 ( version 12.0) my application does not work. My question is why is it having this issue and why am i getting an exception 14.0 could not loaded
Not claiming any expertise on this, but instead of:
Microsoft.Office.Interop.Excel.Application app = new Excel.Application();
you may want to try this code sequence. I believe this will find the relevant info from the system for the installed PIA's and create the appropriate instance.
Type ExcelType = System.Type.GetTypeFromProgID("Excel.Application");
Microsoft.Office.Interop.Excel.Application app;
app = (Microsoft.Office.Interop.Excel.Application)System.Activator.CreateInstance(ExcelType); -
When I went to collage I learned that you should always create a new Excel Object without using Interop, as different Excel versions wouldnt be compatible otherwise, i.a. programming without intellisence. I did some internal programming for a company, and I can tell you that it was a nightmare with just 10 useres... When I found out that one of them had Excel 2003 and the rest had Excel 2005 (or soemthing like that) I just included the dll, the Library 12, and It all worked as expected. However I would never recomend doing this on a massive scale...
which office version i should add to C# application as reference to work with excel 2007 and higher keeping the excel 2007 to be installed as prerequisite to run the application.
-
which office version i should add to C# application as reference to work with excel 2007 and higher keeping the excel 2007 to be installed as prerequisite to run the application.
In my experience (which is not perfect in this area) I would target the 2007 version of Excel, add this version as a DLL resource that follows the exe file you produce. That way it should be able to write files that are compatible with any newer excel file, however you might have a problem in reading newer excel files this way....