删除Excel文档操作窗格

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

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

在这里输入图像说明

我有一个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. } 

尝试这个:

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