我们已经制作了一个正确安装的excel插件,只有在从主图标(或空白工作簿)打开Excel时才会显示.打开任何现有保存的Excel文档时,它不会显示在工具栏上.
我确保在打开现有文档时,在文件 - >选项 - >添加下,它在COM插件中正确检查.对于我们使用我们的添加,我们必须打开一个空白工作簿,并将我们现有的文件拖到空白工作簿.
有谁会知道为什么它只会出现在空白工作簿的功能区而不是现有的.xlsx文件中?
我甚至运行了一个测试,我打开一个空白的工作簿,确认添加在功能区上,将一些文本放在一个单元格中,将其保存到我的桌面,关闭它,然后重新打开它.然后它不显示.这个添加是用VS2010完成的.
这是"ThisAddIn.cs"中的代码
public partial class ThisAddIn
{
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
#region VSTO generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
#endregion
}
Run Code Online (Sandbox Code Playgroud)
这是我们制作的Ribbon.cs文件中的代码......它所做的只是填充几个字段并设置:
private void MyRibbon_Load(object sender, RibbonUIEventArgs e) …Run Code Online (Sandbox Code Playgroud)