如何知道从我的加载项(功能区)安装了哪个单词版本?与C# [英] how to know which word version is installed from my add-in (Ribbon)? with c#
本文介绍了如何知道从我的加载项(功能区)安装了哪个单词版本?与C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用c#构建用于word的加载项. 我的加载项可以在Word 2010和2013上运行.如何知道我的加载项安装了哪个Word版本?
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?
推荐答案
假设您使用的是VSTO,则可以读取Globals.ThisAddIn.Application.Version
属性(请参阅 MSDN博客文章).
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
// ...
这篇关于如何知道从我的加载项(功能区)安装了哪个单词版本?与C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文