how to know which word version is installed from my add-in (Ribbon)? with c#

房东的猫 提交于 2019-12-13 03:06:55

问题


I build add-in for word with c#. my add-in can work on word 2010 and 2013. how to know which word version is installed from my add-in?


回答1:


Assuming you're using VSTO, you can read the Globals.ThisAddIn.Application.Version property (see MSDN Blog article).

string version = Globals.ThisAddIn.Application.Version;
string majorStr = version.Split('.').First();
int major = Convert.ToInt32(majorStr);

if (major == 14)         // Word 2010
    // ...
else if (major == 15)    // Word 2013
    // ...


来源:https://stackoverflow.com/questions/28925050/how-to-know-which-word-version-is-installed-from-my-add-in-ribbon-with-c-shar

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!