I've developped an application for my internship, I've done it in C# .NET 4.5 with Windows 8 64 bits, full compatible with .NET 4.0.
But in fact, I have to install it on old computers with WinXP 32/64 bits and .NET 3.0 without administrator rights...
So now I'm trying to put my project in .NET 3.0 from .NET 4.0 and I have some problems with that, in my code I have:
using Excel = Microsoft.Office.Interop.Excel;
"Office" is underlined with blue.
I also have a error message with "Reference assembly is missing blablabla" So ok, I go to add references assemblies but... Impossible to add them, I tried all of them but it doesn't change anything...
I'm searching on the web but I can't find a good and clear answer, so I'm there :)
Thanks for all (and to all =P)
Solution:
Downgrade your interop.Excel DLL and add it to your references assemblies.
You'll have this error: Impossible to convert type 'object' to 'Microsoft.Office.Interop.Excel.Worksheet'. An explicit conversion exists (cast blablabla)
xlWorkSheet = xlWorkBook.Sheets[1];
So just change this to this:
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Sheets[1];
您可能需要降级office interopt DLL的版本。
Do you have to read and write xls files?
If you only want to read and write xlsx files, you can use OpenXML. It would be a full-managed solution for your problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.