.NET Office Integration Using Office Version Independent

I developed an application that imports data in Microsoft Excel.

I am using VS2005 + .NET 2.0 and Microsoft Office 2007 is installed on my computer (Office 12).

The compiled application works fine if I run it on my machine, but when I deploy the application to other machines they say those that use lower versions (Office 2000), I get an error message:

Failed to load Microsoft.Office.Interop.Excel file or assembly version 12.0.0.0

How could I then turn on my application correctly, regardless of Office (Excel) installed on my computer?

Thanks.

Some updates: I placed two link DLLs, namely Microsoft.Office.Interop.Excel.dll (version 12.0.0.0) and office.dll (version 12.0.0.0) in my bin folder. I set the properties for this link to copy Local = True, and when I compile my application, the DLLs are copied to the debug / release folder.

Now, when I try to start the application, I already got out of this error: "Could not load the file or assembly Microsoft.Office.Interop.Excel, version 12.0.0.0"

but another error occurred: System.AccessViolationException: Attempted to read or write protected memory. This often indicates that another memory is corrupted. in Microsoft.Office.Interop.Excel.WorkbookClass.SaveAs (File object, FileFormat object, Password object, WriteResPassword object, ReadOnlyRecommended object, CreateBackup object, XlSaveAsAccessMode AccessMode, Conflict object, AddToMru object, TextCodepage object, TextVisualLayout object)

So, how can I create an application that could export data to Excel, regardless of the installed version of Office?

Thanks.

+3
source share
4 answers

MS Office Wrapper .NET - , Office (testeod MS Office 97 - 2007 ).

+2

, , Office ( ) , .

PIA Office 2003 ( - Microsoft -), Office 07. Office 2000 XP, , .

+1

, 12 .

csproj "". "" False.

0

, - Excel 2003 Excel 2007.

SpreadsheetGear .NET - , Excel .NET, , , Excel ( , - Excel).

# VB .

: SpreadsheetGear LLC

0

Source: https://habr.com/ru/post/1714573/


All Articles