Table of contents
TOC
折叠目录
展开目录

IRibbonExtensibility.GetCustomUI 方法 (办公室)IRibbonExtensibility.GetCustomUI Method (Office)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

从 XML 自定义文件或嵌入在过程中,自定义功能区用户界面 XML 标记加载 XML 标记。Loads the XML markup, either from an XML customization file or from XML markup embedded in the procedure, that customizes the Ribbon user interface.

语法Syntax

表达式GetCustomUI( RibbonID )expression. GetCustomUI( RibbonID )

表达式_该表达式返回一个IRibbonExtensibility对象。_expression An expression that returns a IRibbonExtensibility object.

参数Parameters

名称Name必需/可选Required/Optional数据类型Data Type说明Description
RibbonIDRibbonID必需RequiredStringStringRibbonX UI 的 ID。The ID for the RibbonX UI.

返回值Return Value

字符串String

注解Remarks

对于 Word、 Excel、 PowerPoint 和访问,则每个应用程序只有一个 ID。Outlook 使用功能区扩展性自定义检查器中,功能区不仅资源管理器中,在各种上下文菜单,请在上下文选项卡在功能区中,并在 Microsoft Office Backstage 视图中的功能区。在每种情况下,开发人员可以指定 Office 调用GetCustomUI具有特定功能区 ID 时,将加载一个 XML 文件中的自定义用户界面For Word, Excel, PowerPoint, and Access, there is only one ID for each application. Outlook uses ribbon extensibility to customize not only the ribbon in an inspector, but also the ribbon in an explorer, in various context menus, in contextual tabs in a ribbon, and in the Microsoft Office Backstage view. In each of these scenarios, the developer specifies the custom UI in an XML file that is loaded when Office calls GetCustomUI with a specific ribbon ID.

示例Example

在以下示例中,用 C# 编写类定义中指定的IRibbonExtensibility接口。然后,该示例实现接口的唯一方法, GetCustomUI。方法在外部的 XML 文件中的自定义标记创建读取SteamReader对象的一个实例。In the following example, written in C#, the IRibbonExtensibility interface is specified in the class definition. The example then implements the interfaces's only method, GetCustomUI. The method creates an instance of a SteamReader object that reads in the customization markup in an external XML file.

public class Connect : Object, Extensibility.IDTExtensibility2, IRibbonExtensibility 
... 
public string GetCustomUI(string RibbonID) 
{ 
 StreamReader customUIReader = new System.IO.StreamReader("C:\\RibbonXSampleCS\\customUI.xml"); 
 string customUIData = customUIReader.ReadToEnd(); 
 return customUIData; 
} 

另请参阅See also

概念Concepts

IRibbonExtensibility 对象IRibbonExtensibility Object

其他资源Other resources

IRibbonExtensibility 对象成员IRibbonExtensibility Object Members

© 2018 Microsoft