2011-05-15 3 views

답변

0

리본은 IRibbonExtensibility 구현을 위해 addin 개체의 RequestService 메서드를 호출하여 만들어집니다.
따라서 addin은 이미 존재해야합니다. 리본 XML 템플릿에서

을 수행 할 수 있습니다 리본 CS 파일에서 다음이 :

public partial class ThisAddIn { 
    private RibbonManager ribbon; 
    ///<summary>Returns an object that extends a feature in the 2007 Microsoft Office system.</summary> 
    ///<param name="serviceGuid">A System.Guid that identifies an extensibility interface 
    ///that is supported by applications in the 2007 Microsoft Office system.</param> 
    ///<returns>An object that implements the extensibility interface that is identified by serviceGuid.</returns> 
    protected override object RequestService(Guid serviceGuid) { 
     if (!String.IsNullOrEmpty(JournalPath) && serviceGuid == typeof(IRibbonExtensibility).GUID) { 
      if (ribbon == null) 
       ribbon = new RibbonManager(); 
      return ribbon; 
     } 

     return base.RequestService(serviceGuid); 
    } 
} 
관련 문제