检查Excel dll并动态加载

时间:2013-05-07 08:37:47

标签: c# excel dll interop

我正在使用Microsoft.Office.Interop.Excel将数据写入Excel文件,我的计算机上安装了Excel 2010。但我需要该程序在旧版本的Excel上运行..

程序应检查特定机器中安装的版本并动态加载dll,以免出现Missing Reference错误。

If Excel 2003 is available, use it.

Else If a higher Excel version is available, use it

Else show an error message since this means that Excel is not installed in the machine

有办法做到这一点吗? 我真的很难找到解决方案。任何帮助,将不胜感激。 提前谢谢..

1 个答案:

答案 0 :(得分:0)

使用NetOffice(http://msdn.microsoft.com/en-us/library/bb417255%28WinEmbedded.5%29.aspx),它确实为所有Office版本提供了一个很好的抽象。

相关问题