Search code examples
excelversionoffice-interop

How wide is the excel interop api support?


I'm using the Excel Interop API for manipulating excel sheets, because this seems to be the best api for using formulas.
My question is that how wide is the support for this API?
For example if someone who has an older or newer version of Microsoft Office than me, will they be able to use the software?
I'm using it with Office 365.


Solution

  • My question is that how wide is the support for this API? For example if someone who has an older or newer version of Microsoft Office than me, will they be able to use the software?

    The answer is yes, your software can be run with different Office versions. You just need to make sure methods and properties exist in the installed version by checking the host version and making a decision to call a particular method or property introduced in recent versions.

    So, I'd suggest using the lowest version of interops libraries which corresponds to lowest Office version supported by your software. By using lowest interop version you can be sure that you deal with properties and methods available in all Office versions and no exceptions will be thrown at runtime.

    If you need to use methods and properties available in latest Office versions you may consider using the late-binding technology available in .Net applications with System.Type.InvokeMember method. Read more about that in the Supporting several Office versions in an add-in. Interop assemblies and late binding. article.