2016-07-28 13 views
0

私はプログラミングが初めてですが、Excelリボンを試してみました。カスタムUIエディタを使用しています。 insertBeforeとinsertAfterコントロールを使用してカスタムボタンを並べ替えることを考えました。ボタンのレベルで一意の名前空間とinsertAfterQ/insertBeforeQを使用しない場合、ボタンの順序は変更されませんが、使用すると関連するマクロが表示されません(おそらくネームスペースのため)。したがって、onActionはボタンをクリックします。私はidQの様々な組み合わせを試みたが、私はそれを動作させることはできません。以下の例では、指定した名前空間にないボタン2だけが正しく実行されます。 簡単な例:カスタムボタンを並べ替える

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" xmlns:x="MyNameSpace"> 
    <ribbon> 
     <tabs> 
      <tab idQ="x:customTab" label="My Order Form" insertAfterMso="TabHome"> 
       <group idQ="x:customGroup" label="My Order Form Tools"> 
        <button idQ="x:customButton1" label="Clear" size="large" onAction="DeleteOrder" image="deleteorder" /> 
        <button id="customButton2" label="Print" size="large" onAction="ResetOrder" image="resetorder" /> 
        <button idQ="x:customButton3" label="Home" size="large" onAction="NewOrder" insertBeforeQ="x:customButton1" image="neworder" /> 
       </group>     
      </tab> 
     </tabs> 
    </ribbon> 
</customUI> 

名前空間内onActionの仕事を作るためにどのような方法がありますか?それとも他の方法がありますか?多くのありがとう、TS

答えて

0

本当に名前空間が必要ですか?

あなたがあなた自身のコントロールの配置を変更したい場合は、XMLだけで場所を切り替える:

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"> 
    <ribbon> 
     <tabs> 
      <tab id="customTab" label="My Order Form" insertAfterMso="TabHome"> 
       <group id="customGroup" label="My Order Form Tools"> 
        <button id="customButton3" label="Home" size="large" onAction="NewOrder" image="neworder" /> 
        <button id="customButton1" label="Clear" size="large" onAction="DeleteOrder" image="deleteorder" /> 
        <button id="customButton2" label="Print" size="large" onAction="ResetOrder" image="resetorder" /> 
       </group>     
      </tab> 
     </tabs> 
    </ribbon> 
</customUI> 

あなたは組み込みコントロールと比較し、あなたのコントロールを配置したい場合は、insertBeforeMsoまたはinsertAfterMsoを使用し、あなたの"customTab"のように。あなたが異なるファイルでcustomUI-xmlのコントロールを組み合わせる場合、名前空間とidQ-idsを使用するだけでよいことが分かります。

関連する問題