是否有在运行时访问功能区(XML)的方法吗? [英] Is there a way to access a Ribbon (XML) at run time?

查看:357
本文介绍了是否有在运行时访问功能区(XML)的方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个Word 2007应用程序级加载项。到目前为止,我还没有除加载项的Ribbon界面转换为XML经历了重大的障碍。我必须使用功能区XML,因为我工作的功能只能做到这样。的问题是,通过切换到区XML我不再能在运行时经由Globals.Ribbons访问的接口。此链接 http://msdn.microsoft.com/en-us/library/bb772088的.aspx 做得很好解释了如何访问一个可视化设计器功能区,但它完全忽略了XML功能区情况。具体来说,我需要能够访问一些可视控件,如标签。我怎样才能做到这一点?

I'm working on a Word 2007 app-level add-in. So far, I haven't experienced major obstacles except for converting the add-in's Ribbon interface to XML. I have to use Ribbon XML because the feature I'm working on can only be done this way. The problem is that by switching to Ribbon XML I can no longer access the interface at run time via Globals.Ribbons. This link http://msdn.microsoft.com/en-us/library/bb772088.aspx does a good job explaining how to access a Visual Designer Ribbon but it completely ignores the XML Ribbon case. Specifically, I need to be able to access some visual controls such as labels. How can I achieve this?

推荐答案

Globals.Ribbons是VSTO设计的功能,如果你使用RibbonXML那么你不必此功能。
什么设计师在幕后实际上做的是它会创建功能区XML的Office,然后当办公室做一个回调,VSTO将引发相应的事件处理程序,这方面(文件)。由于您使用的是RibbonXML你完全绕过了VSTO功能区设计支持(我更喜欢这种方式,它更快,你有更多的控制)。

Globals.Ribbons is a VSTO designer feature, if you use RibbonXML then you don't have this feature. What the designer actually does under the covers is it will create ribbon xml for Office, then when office makes a callback, VSTO will raise the appropriate event handler for that context (document). Because you are using RibbonXML you are bypassing the VSTO Ribbon designer support entirely (I prefer it this way, it is faster and you have more control).

通过区XML,你必须注册为您的标签一个的onLoad回调,办会再传给你一个IRibbonControl,这将是标签,你有有限的东西你可以做。如果你想改变的文本,然后把我的头顶部,你必须注册一个gettext的回调,那么无效色带控制,这将导致的getText回调重新评估。

With ribbon XML you will have to register a onLoad callback for your label, Office will then pass you a IRibbonControl, which will be the label, and you have limited stuff you can do. If you wanted to change the text then off the top of my head you would have to register a getText callback, then invalidate that ribbon control, which will cause the getText callback to be reevaluated.

有关于你真正想实现将方便些什么信息=)我有一种感觉,我VSTO的contrib项目也将让您的生活更容易,因为它给你很多的不错的功能区设计功能使用色带XML时。不过,让我知道什么是你想做的事,我可以给你更多的信息。

Having more info about what you actually want to achieve would be handy =) I have a feeling my VSTO contrib project will also make your life much easier, as it gives you many of the nice Ribbon Designer features when using ribbon xml. But let me know what it is you want to do, and I can give you more info about that.

干杯,
杰克

这篇关于是否有在运行时访问功能区(XML)的方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆