尝试使用 VSTO 打开 Word 插件

问题描述 投票:0回答:2

我正在使用 VSTO 来开发插件这个词。我已经开发了功能区,但我想不出打开侧边栏的方法。我附上了所需内容的示例图像。基本上就像 Grammaly 所做的那样,在按钮上按下侧边栏打开。

enter image description here

c# vsto office-addins word word-addins
2个回答

0
投票

演练:将自定义任务窗格与功能区按钮同步演示了如何创建用户可以通过单击功能区上的切换按钮隐藏或显示的自定义任务窗格。

如何:将自定义任务窗格添加到应用程序 指南介绍了如何在任何 Office 应用程序中创建任务窗格。例如,通过以下方式声明将用于自定义任务窗格和任务窗格实例的用户控件:

private TaskPaneControl taskPaneControl1;
private Microsoft.Office.Tools.CustomTaskPane taskPaneValue;

然后创建一个新实例,将以下代码添加到

ThisAddIn_Startup
或任何功能区事件处理程序。此代码通过将
CustomTaskPane
对象添加到
MyUserControl
集合来创建一个新的
CustomTaskPanes
。该代码还显示任务窗格。:

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
    taskPaneControl1 = new TaskPaneControl();
    taskPaneValue = this.CustomTaskPanes.Add(
        taskPaneControl1, "MyCustomTaskPane");
    taskPaneValue.VisibleChanged +=
        new EventHandler(taskPaneValue_VisibleChanged);
}

private void taskPaneValue_VisibleChanged(object sender, System.EventArgs e)
{
    Globals.Ribbons.ManageTaskPaneRibbon.toggleButton1.Checked = 
        taskPaneValue.Visible;
}
© www.soinside.com 2019 - 2024. All rights reserved.