问题
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