C# 删除excel文档操作窗格
我们可以使用开发者->扩展包->Microsoft操作窗格->附加将文档操作窗格附加到任何excel文件 保存excel并再次打开它后,excel文档先前已存储 我有一个Excel文件(参考图像),我希望使用c#中的inter-op编程删除(分离)文档操作窗格。有可能吗 代码段:C# 删除excel文档操作窗格,c#,excel,vsto,excel-interop,vba,C#,Excel,Vsto,Excel Interop,Vba,我们可以使用开发者->扩展包->Microsoft操作窗格->附加将文档操作窗格附加到任何excel文件 保存excel并再次打开它后,excel文档先前已存储 我有一个Excel文件(参考图像),我希望使用c#中的inter-op编程删除(分离)文档操作窗格。有可能吗 代码段: Application xlApp = null; try { xlApp = new Microsoft.Office.Interop.Excel.ApplicationClass();
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;
试试这个:
Microsoft.Office.Interop.Excel.Application.DisplayDocumentActionTaskPane = false;
它隐藏了“文档操作”任务窗格,但下次我重新打开excel文件时,“文档操作”窗格仍然存在:(它隐藏了“文档操作”任务窗格,但下次我重新打开excel文件时,“文档操作”窗格仍然存在:(