Question:
Is it possible to make the application work on a PC where the required version of office is not available?
I developed an application where the office was 2016, then I threw the application on a PC, where the office was 2007 and there were problems when starting …
The 2007 office was on the machine and I tried to throw the library (Like, from 2016) and got the following error:
System.IO.FileLoadException: Could not load file or assembly 'office, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) File name: 'office, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
From the office, I use only Access, for example, I execute queries, and somewhere I open a RecordSet and update one record at a time …
Answer:
Microsoft has freely redistributable components for such cases. For Access 2016 – you can get it here . There are similar components for some other applications from the MS Office package. These components do not allow you to create files, but allow you to view and print, and if the Excel or Access file is an application, then use the functions of such an application. In fact, these components contain everything you need except for the interface for creating and editing, which you can implement in your program.
Thus, you can not require the user to have an installed office, but include such a component in your installer and install it together with the application, or leave the choice to the user, install the full office package for yourself, or install only components for viewing documents, which is actually written in the component description, for example Microsoft Access 2016 Runtime
:
Microsoft Access 2016 provides a rich platform for developing database management solutions with easy-to-use customization tools. If no end-user customization is required (including report modifications), you can choose to distribute those Access 2016 solutions so that they run without requiring a full installation of Access 2016. To do so, you must package and distribute your application with the Access 2016 runtime.