VSTO - 检索编辑框值

VSTO - Retrieve editbox value

这是我的 ribbon.xml 文件:

  <ribbon>
    <tabs>
      <tab label="My Tab" idMso="TabAddIns" >
        <group label="My Group">
          <labelControl label="Input : "/>
          <editBox id="editbox1" label="here"/>
          <button id="go" label="go" onAction="go_click"/>
        </group>
      </tab>
    </tabs>
  </ribbon>

现在在 go_click 函数的后端部分,我想检索 editbox1 中插入的值。

我该怎么做?我偷偷摸摸的,但没找到那么多。

    public void go_click(Office.IRibbonControl control)
    {
          // Try to retrieve content of `editbox1` here
    }

您需要为 editbox 控件实现 onChange 回调 - 每次修改文本时都会调用它。回调将 IRibbonControl 和一个字符串作为参数。