2013-04-09 143 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