2013-04-09 142 views
1

我们可以使用开发人员 - >扩展包 - > Microsoft操作窗格 - >附加,将文档操作窗格附加到任何Excel文件。删除Excel文档操作窗格

一旦保存了excel并再次打开它,以前将存储excel文件。

enter image description here

我有一个Excel文件(参照图像),我希望在c#使用帧间运算编程以除去(分离)文件操作窗格。有可能这样做吗?

代码片段:

Application xlApp = null; 
try 
    { 
     xlApp = new Microsoft.Office.Interop.Excel.ApplicationClass(); 
     string versionNo = xlApp.Version; 
     xlApp.Visible = true; 
     Microsoft.Office.Core.MsoAutomationSecurity mso = xlApp.AutomationSecurity; 
     xlApp.AutomationSecurity = Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityForceDisable; 
     Workbook newWb = xlApp.Workbooks.Open(fileName, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); 

     // Here want code to detach document action pane. 
    } 

回答

1

试试这个:

Microsoft.Office.Interop.Excel.Application.DisplayDocumentActionTaskPane = false; 
+0

它隐藏文档操作任务窗格中,但下一次,当我重新打开Excel文件,文档操作窗格中仍然存在。 :( – 2013-04-10 05:47:55