none
关于Excel插件 RRS feed

  • 问题

  • 有个第三方的插件集成在Excel里(展现为Excel里多了一个菜单,和一个工具条),正常打开Excel,这些菜单和工具条都有,但我通过程序打开Excel,却没有这些菜单和工具条,请教如何解决,我的打开程序如下
     object o = System.Reflection.Missing.Value;
                Microsoft.Office.Interop.Excel.Application excelapp = new Microsoft.Office.Interop.Excel.ApplicationClass();
                Microsoft.Office.Interop.Excel.Workbook wkbook = excelapp.Workbooks.Open(this.textBox1.Text, 3, o, o, o, o, o, o, o, o, o, o, o, o, o);
                wkbook.RunAutoMacros(Microsoft.Office.Interop.Excel.XlRunAutoMacro.xlAutoOpen);
                Microsoft.Office.Interop.Excel.Worksheet wksheet = (Microsoft.Office.Interop.Excel.Worksheet)wkbook.Worksheets[1];
                excelapp.Visible = true;
    2009年12月4日 15:00

答案

  • 试试

         // Create the Excel.Application object using interop
         // Get .NET visibility
         _XlApplication = (Excel.Application)_Workbook.Application;
         // Creation of the standard toolbar NOTE there are many tool bars which
         // you can iterate through to see. But Standard is the big Kahuna
         _StandardCommandBar = _XlApplication.CommandBars["Standard"];
         //This is the fix for Problem 2 above
         _StandardCommandBar.Position = Office.MsoBarPosition.msoBarTop;
         _StandardCommandBar.Visible = _ToolBarVisible;
    【孟子E章】
    2009年12月5日 12:53
    版主